PDA

View Full Version : Best way to destroy and recreate pop up?



bstras21
4 Jan 2012, 12:09 PM
I have a popup that contains an xtype and it works the first time but when I try to use it again after I destroy it, it's not recognized. I saw some posts on initComponent but I am using touch2 pr2. What is the best solution for this?



if (!popup) {var popup = Ext.create('Ext.Panel', {
fullscreen: true,
id:'mainPopup',
layout: 'card',
items:[{
xtype: 'PunchType'
},{
xtype:'panel',
docked:'bottom',
id:'listPanelButtons',
items:[{
xtype: 'button',
id: 'saveBtnPunch',
handler: function(){
localStorage.clear();
}
},{
xtype: 'button',
id: 'cancelBtnPunch',
handler: function(){
popup.destroy();
}
}],
},{
docked: 'top',
id:'topPopup',
html: description
}]
//}
});
}

bstras21
5 Jan 2012, 6:32 AM
I am using touch2 pr3 and it seems that destroying the popup and recreating it changes the id of the component.

For instance my id looks like this:

id: 'testID'

and it works the first time then when I destroy it and recreate it, I look in the inspector and see this:

id: '"ext-container-11"'

Looks like this is a bug.

Acts7Seven
28 Aug 2014, 7:29 AM
http://www.ryanbennett.com/sencha-touch/sencha-touch-2-quirks-controller-refs-componentquery-and-using-id-vs-itemid/

A little know bug. Better explained here:
http://www.ryanbennett.com/sencha-touch/sencha-touch-2-quirks-controller-refs-componentquery-and-using-id-vs-itemid/

You cannot directly reference a child id. You must reference the parent "id" or "itemId" and then the child id/itemId

(http://www.ryanbennett.com/sencha-touch/sencha-touch-2-quirks-controller-refs-componentquery-and-using-id-vs-itemid/)