NerdyHearn
Home
Blog

Contact
Mailing List

Software


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

Enabling .NET Framework 3.5 in MOSS/WSS After install

Resolving "Tracing Service lost trace events" in MOSS 2007


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. SaveMySerials - Protect yourself from theft, fire, natural disasters and more by recording your serial numbers