View Full Version : Can not read property 'fn' of undefined

5 Sep 2011, 8:41 AM
Hi whenever I close gridpanel from menu and reopen it again ,I am getting following error, I am using extjs 4.0.2a version. Please let me know if anyone had this problem and resolve

Uncaught TypeError: Cannot read property 'fn' of undefined
ext-all-debug.js:3939 (http://localhost:8080/i/lib/ext-4.0.2a/ext-all-debug.js)Uncaught TypeError: Cannot call method 'substring' of undefined
ext-all-debug.js:24670 (http://localhost:8080/i/lib/ext-4.0.2a/ext-all-debug.js)Uncaught TypeError: Cannot read property 'left' of undefined

ext-all-debug.js:3939 (http://localhost:8080/i/lib/ext-4.0.2a/ext-all-debug.js)Uncaught TypeError: Cannot call method 'substring' of undefined

6 Sep 2011, 12:25 AM
Close/reopen errors are almost always caused by the same thing. Unless you specify otherwise, closing a component will destroy it and of its children. If you subsequently try to use any of those objects it will give unpredictable behaviour but almost invariably it throws an error.

We'd need to see some code if you need more help. A complete, minimal test case would be ideal but some snippets showing how you do the close/reopen might be sufficient.

6 Sep 2011, 5:50 AM
autoDestroy is the config you may be looking for

6 Sep 2011, 2:18 PM
I have mentioned autoDestroy : false.for form panel and for gridpanel ,I didnt define config for autoDestroy. so do I need to use autoDestroy true ?

6 Sep 2011, 6:31 PM
true is the default and with good reason. Use extreme caution changing it to false, if you don't understand what's going on it can cause huge memory leaks.

7 Sep 2011, 11:57 AM
My code is very huge in size and could not post here. But I can inform scenario of my task. I have grid panel with form panel on button click. when I do some operation on form panel and save my data . Till here it is OK. it works . But , on button click onto another form panel button , I am calling same grid panel . So grid opens, but when I close it and try to call it again same grid or existing grid panel then it throws those errors. While writing this message, now i found this error

Uncaught TypeError: Cannot read property 'style' of undefined.
when I opened the file, it was pointing on window.show() line.

when I refresh the page many times then it works fine for some times but again gives same error.

or is it issue of some DOM handling ? I am not vey much aware of it.

7 Sep 2011, 1:56 PM
Try to produce a stripped down test case. If your code is huge and unmanageable I'd focus on restructuring first and you might be able to locate the issue a lot easier even...