PDA

View Full Version : reuse items in tabpanel



ffu
13 Aug 2013, 10:24 PM
Hello:

I have some items (buttons and textfields) wanting to be reusable for tabs in a tabpanel.

I Ext.create the items then use activate listener to add a panel with all the items. I tried to use deactivate listener to remove those items. I am getting a error "TypeError: el is null".

Could anyone point me where the problems or any other methods to reuse items for tabpanel?

Thanks.
Frank

Part of the code is below:

Ext.apply(this, {
xtype: 'Ext.tab.Panel',
//width: 7,
//height: 75,
activeTab: 0,
defaults: {
bodyPadding: 10,
},
items: [{
title: "Day",
listeners: {
scope: this,
activate: function (panel) {
panel.add([{
xtype: 'panel',
itemId: timePanelId,
border: 0,
layout: 'hbox',
items: [preBtn,dateField,calendarBtn,goBtn,nextBtn]
}]);
//panel.doLayout();
console.log(panel.getId());
},
deactivate: function (panel) {
console.log("day tab before deactivate");
console.log(panel.items.length);
panel.removeAll();
//panel.remove(timePanelId, true);
}
}
}, {
title: "Week",
listeners: {
scope: this,
activate: function (panel) {
//panel.removeAll();
panel.add([{
xtype: 'panel',
itemId: timePanelId,
border: 0,
layout: 'hbox',
items: [preBtn,weekField,yearField,calendarBtn,goBtn,nextBtn]
}]);
//panel.doLayout();
},
deactivate: function (panel) {
console.log("week tab before deactivate");
panel.removeAll();
//panel.remove(timePanelId,true);
}
}

scottmartin
18 Aug 2013, 7:37 AM
See if the following will help:
http://www.sencha.com/forum/showthread.php?205674

Scott.