PDA

View Full Version : Loading Ext.JS4 only when needed?



thomasf11
12 Aug 2011, 11:05 AM
Ladies & Gentlemen,
My Goal is to load the Ext Framework (JS File) only when needed.
Problem:
When loading Ext.JS at a later state Ext.onReady doesn´t fire. I tried working around Ext.onReady, which I didn´t get to work either. I´d be happy for any insight. I´ve also tried various loaders other than jQuery.
The non-working sample:
http://jsfiddle.net/thomasf1/XNJxT/21
Same example, but loading Ext.JS immediately (works):
http://jsfiddle.net/thomasf1/WvcZu/1/
Same example, later load of grid, but immediate include of JS (works):
http://jsfiddle.net/thomasf1/WvcZu/2/
Thanks in advance for any idea!
Thomas

mitchellsimoens
12 Aug 2011, 1:52 PM
What you could do (and you don't need any JS framework) is create the script tags and link tags using JavaScript and add a listener for the loading of the script tags. Once they are loaded, fire the onReady yourself.