Basically I have a window containing a formPanel with items, that is shared at multiple places. Meaning that the formPanel's items might vary slightly. (the type of controls).
I've managed to dynamically clear and add custom buttons for the appropriate situation on the window.
But I'm experiencing a slight problem with the formPanel's items.
Digging into to source, I found that in the Ext.Container initComponent method there is this little piece of code:
var items = this.items;
if(items){
delete this.items;
if(Ext.isArray(items)){
this.add.apply(this, items);
}else{
this.add(items);
}
}
This seems to be similar to what I'm trying to achieve. Deleting all the current items and then calling the formPanel.add method would once again invoke this code:
if(!this.items){
this.initItems();
}
This is all fine up to here. And the initial load of the form works perfectly. Although, when I hide the window, and open it again, the clear/reload of items works perfectly on my component, but the previous childNodes/items are still present in the dom.children and dom.innerHTML.
Thus my formPanel now displays two or more sets of controls that doesn't have any values, and the newly loaded controls at the bottom with the actual values.
I do invoke formPanel.doLayout() after the clearing/adding of items.
I've also tried calling the formPanel.remove method on every item currently on the formPanel, but I still end up with duplicates displaying, and the layout doesn't seem to dock/anchor properly, as I end up with a horizontal scroll bar underneath each item.
What else can I do to actually clear/reload the dom.children and dom.innerHTML ?
Any help would be greatly appreciated.
I'm using ExtJS 2.1 if it makes any difference.