I have to remove a selected item in an editorgrid. First the store is loaded and the user can choose to add or delete blank rows to this grid which they can then edit. The problem is not with removing initial records loaded from the store. The problem comes in when I add an additional row, edit it and then choose to remove it (user may decide he doesn't need this row after all).
It seems that when I would like to save changes using store.getModifiedRecords, it still sees the row that was deleted and so processes it as well. Here is the button remove:
442
443 text:'Remove',
444 tooltip:'Remove attribute',
445 iconCls:'silk-table_delete',
446 handler: function() {
447 var selectedItem = attributeEditor.getSelectionModel().getSelected();
448
449 // Check if we have selected item
450 if (selectedItem) {
451 // Get selected item value
452 var attribute = selectedItem.get('Name');
453
454 // Remove selected
455 attributeStore.remove(selectedItem);
456
457 // Add to our removed attributes hash
458 if (id) {
459 RemovedAttributes.push(attribute);
460 }
461 } else {
462 wispUserFormWindow.getEl().mask();
463
464 // Display error
465 Ext.Msg.show({
466 title: "Nothing selected",
467 msg: "No attribute selected",
468 icon: Ext.MessageBox.ERROR,
469 buttons: Ext.Msg.CANCEL,
470 modal: false,
471 fn: function() {
472 wispUserFormWindow.getEl().unmask();
473 }
474 });
475 }
476 }
477 }