NerdyHearn
Home
Blog
Software

Contact
Mailing List

IPhone Products
SMS To Gmail
Voicemail To Gmail
Calls To Calendar

Other Products
TiffWizard

Sites
SaveMySerials
How Long For Me
DocuTerminal
Subsonos

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

Adding a Custom ASP.NET Page to MOSS/WSS
Fixing "Error in loading DLL" in SharePoint
Web form to help audit permissions in SharePoint 2007/MOSS
Retrieving data from SharePoint SOAP Requests using LINQ
Creating a dynamic SharePoint settings DropDown using a ToolPart

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 SubSonos - Stream your subsonic music collection to your Sonos wireless system