PDA

View Full Version : Error when try to remove and add new item in viewport resize listener



peterpcm3
21 Sep 2012, 1:47 AM
hi,
i create a viewport with tabpanel, but i want when resize viewport to remove items from it and to add new item.



listeners: {
resize: function(viewport){
try
{
viewport.removeAll();


viewport.add(Ext.create('Ext.app.TabPanel'));


viewport.doLayout();
}
catch(e)
{
console.log(e);
}
}
}


Stack trace is:
stack: "Error: An attempt was made to reference a Node in a context where it does not exist"

My question is how can add and remove items when resize viewport without error. I use extjs version 4.0.7

Thanks

mitchellsimoens
24 Sep 2012, 6:29 AM
Which piece throws the error? Also, you shouldn't really have to call doLayout anymore

peterpcm3
24 Sep 2012, 8:27 AM
When i call viewport.removeAll(); and comment add method application crash with follow exception:
DOMException

code: 8
message: "NOT_FOUND_ERR: DOM Exception 8"
name: "NOT_FOUND_ERR"
stack: "Error: An attempt was made to reference a Node in a context where it does not exis"
__proto__: DOMException

and i can not find why.