PDA

View Full Version : how to remove item from fieldset



muncher
5 Oct 2010, 8:13 AM
I am able to add an item to a fieldset but not remove it. Keeping reference to the added object doesn't help either. I can see that item is removed from the items array of the fieldset object but not from the UI.



...................
///itemHash is a private variable.
,addNewItem:function(tag, name) {

var textbox = new Ext.form.TextField ({fieldLabel:name, name:name,maxLength:2});
this.items.add(textbox);
this.itemHash[tag]=textbox;
//this.doLayout();
}//end of add
,removeItem:function(tag, name) {
this.items.remove(this.itemHash[tag]);
delete this.itemHash[tag];
this.doLayout();
}//end of remove
.................

Animal
5 Oct 2010, 10:09 AM
Either remove and destroy (destroy cleans up everything, and makes the Component unusable), or if you want to use it again use this Container plugin:

http://www.sencha.com/forum/showthread.php?105909-ContainerClear.-Plugin-to-cause-Container.remove-to-remove-removed-Components

That shifts a removed child sideways into a hidden Container so you can use it again.