PDA

View Full Version : formPanel add remove item



nelmoulaoui
18 Nov 2010, 1:49 AM
I have a "formpanel" with for example 4 elements "items". When I make a formPanel.add (new item ), he indeed adds the element.

When I make a " this.el.up ('.x-form-item.x-form-item ') .remove () " to delete an element (item), he makes it but he does not decrease the number of items of the "formPanel".

any ideas ?

danguba
18 Nov 2010, 9:09 AM
Try to use remove method of form panel

Animal
18 Nov 2010, 9:49 AM
I have a "formpanel" with for example 4 elements "items". When I make a formPanel.add (new item ), he indeed adds the element.

When I make a " this.el.up ('.x-form-item.x-form-item ') .remove () " to delete an element (item), he makes it but he does not decrease the number of items of the "formPanel".

any ideas ?

You should learn the Component tree.

As with DOM, ExtJS Components have a tree structure, and Containers contain Components. And they maintain child/parent and sibling linkage.

You should not yourself access the DOM and break the Component's state. It will not know you have done that.

You must use the remove method to remove the item from the FormPanel.

Do you want the item to be destroyed, never to be used again?