Extjs component Not created correctly inside jQuery
Extjs component Not created correctly inside jQuery
Hi all, i use Extjs 4.0.7,
i need create an ExtJS component object inside jQuery $(function(){}), but it seems that the component is not initialized properly.
When i change the "$(function())" to the "Ext.onReady()" it executed successfully. Using "Ext.onReady()" is not an option for me because I am trying to load (inject) the page that contains the "Ext.onReady()" dynamically into the <div> tag (not iframe). At first i thought the script should execute as expected, however in actual test run the "Ext.onReady()" was never called at all.
I tried to debug using chrome, and I found out that when using $(function()) I got this error in file ext-all-debug.js line 41280
// throw error "Uncaught TypeError: Cannot call method 'setSize' of undefined"
//the surface is undefined
this.owner.surface.setSize(width, height);
while when using Ext.onReady
( using non dynamic method to load the page), the "this.onwer.surface" is defined correctly.
could someone shed a light to resolve this issue?
I developed a web gui constructor using jquery before i found out about the ExtJS Framework, however if I stopped the current development and start over from scratch using ExtJS framework, it will take a long time to reach the stage where i am at now. So decided to use only some of the ExtJS components such as grid, panel to shorten my GUI component only like grid, panel etc. to support my gui constructor.
Overall developing using with ExtJS has been a pleasant experience till I found another problem and think the root of the problem due to my attempt to load Extjs file dynamically
please see the sample page I have created for you,
this site will loading Ext Js (ext-all-debug.js) dynamically :
you will see the error when seeing the console form in chrome http://devcrash.net/dynamic/
and this site will loading Ext js static (write directly to the head tag of html) :
no error found http://devcrash.net/static/