mardi 3 juin 2014

Unable to get property 'detach' of undefined or null reference ( list )

I'm using sencha touch 2.3.1.

I have a list which on clicking opens a new view.

It works fine most of the time.

But sometimes, when I open a list and go back to my main list view, I get the following error:



Unable to get property 'detach' of undefined or null reference



Normally, most of the devices ignore that error and continue working. But that's not the case with windows 8 desktop apps. The app crashes instantly.

I think this happens because the view I opened is not destroyed. When I add an Id to that view and try again, I get the following error sometimes.




[WARN][Ext.Component#constructor] Registering a component with a id (`id-reportrender`) which has already been used. Please ensure the existing component has been destroyed (`Ext.Component#destroy()`.



Is there any way to resolve this?

I tried manually destroying the view before pushing it by using the following code:

Code:



if(Ext.getCmp('id-reportrender'))
Ext.getCmp('id-reportrender').destroy();

where id-reportrender is the id of the view opened.

But this didn't work for me. I get the same error ( Unable to get property 'detach' of undefined or null reference ) .

Please help me resolve this.

Thanks





Aucun commentaire:

Enregistrer un commentaire