PDA

View Full Version : Delete (cancel) the new row in a formpanel.



mo_sze
27 Apr 2011, 12:44 AM
Hi,

I have a form panel, and you can add any number new row to it. But before you save the all, you can cancel each row if you want.
Now the problem is, I dont know, how can I remove the selected row from the form.

Thanks.
mo_szeki

friend
27 Apr 2011, 9:19 AM
A Form doesn't support the notion of 'rows'. Are you referring to a grid?

varunach
27 Apr 2011, 12:31 PM
if you're referring to a row of components (all contained inside a parent container), then try



var myParentContainer = new Ext.getCmp('myParentContainerId');
myformpanel.remove(myParentContainer);

mo_sze
29 Apr 2011, 3:03 AM
First of all, I want to thank you the help!

I spend a lot of time to find out it, but the point is:
I insert a grid panel into the formpanel.
First when the user add new row I create the grid and insert it to the form panel, and when the user wants to add a new one I insert an empty row into the grid panel.

MO_SZE

friend
29 Apr 2011, 5:03 AM
You first have to identify the row in the grid's data store which is to be deleted, then remove it.



// an Array is returned, even if only one matching record is found.
var targetRecord = myGrid.store.find('someFieldName', 'someValue');

// remove() accepts a single record or array of records.
myGrid.store.remove(targetRecord);