PDA

View Full Version : Delete option not working fine in editor grid panel



sachin sachdeva
28 Dec 2010, 12:40 AM
HELLO Sir
I have a editable which has a delete button which works fine when i delete first cell and and then second cell but when i delete second cell first it deletes the first cell in place of second cell .here i am sending you a delete function that i am using plz let me know where i am mistaken.


Ext.MessageBox.confirm('Delete','Are you sure you want to delete this record', function(btn) {

if (btn == 'yes') {
var index = Egrid.getSelectionModel().getSelectedCell();
if (!index) {
return false;
}
var rec = this.store.getAt(index[0]);
this.store.remove(rec);


store.reload();

}
});

Condor
28 Dec 2010, 12:53 AM
(!index) is also true if index = 0, so you need:

if (Ext.isEmpty(index)) {

sachin sachdeva
28 Dec 2010, 2:42 AM
Thanx CONDOR U ROCKS MAN