NerdyHearn
Home
Blog

Contact
Mailing List

Software

Active Directory Products
Object Compare
Permission Compare

IPhone Products
Calls To Calendar
SMS To CSV
SMS To Gmail
Voicemail To Gmail

Sites
DocuTerminal
How Long For Me
My Music To Me
SaveMySerials
TypeCount

Blog
Twitter

NerdyHearn - Blog


<< Back To All Blogs

Using Ext JS in SharePoint... a tip

Friday, September 26th, 2008

Continuing with my SharePoint fun with JavaScript, I have been using Ext JS embedded into SharePoint for some development lately, and was continually receiving the error "Ext is undefined" while trying to load the generic, always-used, Ext.onReady function, such as follows:

Ext.onReady(function(){
... my perfect code here ...
});

It turns out that the problem is caused by SharePoint yet again mangling the things that normally work perfectly, and as-expected. SharePoint manipulates the script tags on the page (for whatever reason is beyond me) which in turn effects the loading order of these scripts. I was receiving the "Ext is undefined" message because of exactly that, Ext, at that time, was still undefined.

The only way that I could find to get around this for the time being, until myself or someone else finds a better way, was to wrap the Ext code in the generic body.onLoad event, such as follows:

document.body.onload = function() {
... my not so perfect code here ...
}

Hopefully this will once again save someone a SharePoint JavaScript head ache, as it definitely caused one for myself.

JavaScript SharePoint Skeptical Tom Out.

Tags

SharePoint JavaScript

Related Blogs

Fixing MOSS Search Crawler issue for "The specified address was excluded..."
Creating a dynamic SharePoint settings DropDown using a ToolPart
Understanding SharePoint Template Ids
Using Data Protection Manager 2007 For Disaster Recovery on SharePoint
Up the creek without a paddle: Taking over a deserted SharePoint 2007 installation

Comments

Tom said on Thursday, June 18th, 2009 @ 10:30 AM

Hi Henry,
Glad to hear it helped, this was one that drove me crazy for a while, so I feel your pain!


Henry said on Thursday, June 18th, 2009 @ 10:06 AM

I was having this very same issue. I had the suspicion that somehow Sharepoint is messing with the script since it had worked perfectly fine outside of Sharepoint. Thanks for info!

Add A Comment

Name:


URL:


Email Address: (not public, used to send notifications on further comments)


Comments:



Enter the text above, except for the 1st and last character:


NerdyHearn - Latest tech news relating to C#, ASP.NET, SharePoint, PHP, general development, and more. DocuTerminal - Online Filing Cabinet solution. Scan, search and archive your paper documents. SaveMySerials - Protect yourself from theft, fire, natural disasters and more by recording your serial numbers My Music To Me - Stream your subsonic music collection to your Sonos wireless system TypeCount - Count how often you type across different computers! ServrTrackr - Monitor your SSL certificates, website uptime, and DNS configurations