20 Feb 2013 7:00 AM #1
[ExtJS 4.1.1a] Error using cmp.removeAll
i have a big ExtJS application where i am using removeAll to replace the content of a container (first removeAll, then add new content). The problem is that in IE i get the error
"Das Objekt unterstützt die Eigenschaft oder Methode "removeEventListener" nicht"
(In english something like "The object doesn't have the property or method 'removeEventListener'")
The error occurs in Ext.EventManager.removeListner (after the check if detachEvent exists). I think that the error occurs because the EventManager tries to remove an event from a dom object which doesn't exist anymore.
I am sorry but i didn't manage to provide a test case because the error doesn't seem to occur in simple cases.
Doesn anybody have an idea what i am doing wrong? May sencha should add a test if the dom is still valid before calling "removeEventListener"?
Thanks a lot!
The error only occurs if i call "cmp.removeAll(true)" but doesn't if i call "cmp.removeAll(false)". But if i don't destory the elements the browsers memory gets filled, doesn't it?
20 Feb 2013 1:07 PM #2
I did some further research and the error occurs on removing the "click" handler from a triggerWrap element of a file upload field. The element seems not to be a valid element (anymore).
I have tried to edit the initial post but every time i saved the change i was logged out and received a message that told me i don't have permissions and should login again.
21 Feb 2013 12:32 AM #3
Sorry for reposting again but i still may not edit my posts.
I finally did manage to create a test case that triggers the error. Code first:
Am i doing anything wrong or is this a bug in ExtJS?
The error seems only to be triggered if the target of the ComponentLoader is the same as the target get gets cleared.
12 Aug 2014 10:52 PM #4
sorry for posting on an old thread. I am facing the same problem in ExtJS 4.2. Did you or anyone else manage to find a solution?
I have a panel which is the center region in a border layout and I want to remove all the components in it and add new ones when the user performs certain actions.
12 Aug 2014 10:58 PM #5
in my case the error was caused by using the panel that should get the content replaced as the target of the ComponentLoader.
Not sure if this applies also to your case.
13 Aug 2014 1:11 AM #6
thanks for the quick reply!
Let me elaborate my scenario. I have a main panel which is rendered to Ext.getBody(). this panel has border layout with a tree as east region (which serves as menu) and a panel as center region. When the user clicks on a tree node, I want to remove the existing contents from the center region and add new components (e.g. a grid) according to the tree node which was clicked.
So on itemclick event of the tree node, I am calling removeAll on the center region panel. This is when the error occurs.
I discovered that the error doesnt occur in compatibility mode in IE and it didnt occur in ExtJS 4.0.7. I have posted a new question on ExtJS Q&A Forums and will see if I can get a response there. Otherwise, I will be forced to use 4.0.7.
13 Aug 2014 1:22 AM #7
i am sorry but i don't think that this is the same scenario as it was for me. In my case the error was not caused by a usual call to removeAll but by calling removeAll from a ComponentLoader that had the same element as a target as the one that should be cleared.
Maybe your scenario causes the same error but i don't think that my solution works for you as you don't even use a ComponentLoader.
13 Aug 2014 1:24 AM #8
yes it is a different scenario but the main problem behind this error is that IE8 and upwards doesnt support removeEventListener and addEventListener which are used by ExtJS 4.2.x and hence this error. I think 4.0.7 wasnt using these functions. thanks for your replies though. If i find something out, I will reply again for future reference.
18 Aug 2014 12:11 AM #9
I discovered that the error I was getting in IE was not because of removeAll(); it was because of update()! I had some HTML in the panel and i was calling panel.update(""); to clear it before calling panel.removeAll(); This is not so crucial and I can just remove the update as its not really needed anymore.
Hope this helps someone looking for similar problems in the future.