PDA

View Full Version : Ext.Panel.removeAll() create error



pothibo
24 Feb 2011, 9:22 AM
Uncaught TypeError: Cannot read property 'parentNode' of undefined this is the error I'm getting. Here's the code:


setSearchOptions: function(terms) {
this.searchOptions = terms;
if (this.items !== undefined && this.items.getCount() > 0) {
this.removeAll();
if (this.buttons !== undefined && this.buttons.length > 0) {
this.buttons.clear();
}
}

for (i = 0; i < this.searchOptions.getCount(); i++) {
row = new Ext.Panel({
layout: 'hbox',
});

if (i > 0) {
for (buttonIdx = (i - 1)* 2; buttonIdx < this.searchOptions.length && buttonIdx < (i) * 2; buttonIdx++) {
this.buttons.add(row.add({
xtype: 'button',
text: this.searchOptions.get(buttonIdx).get('term')
}));
}
} else {
row.add(this.textfield);
}
this.add(row);
}
this.doComponentLayout();
}

However, if I use removeAll(false) instead, first, the error disappear but the objects aren't removed as childs of the current panel.