[CLOSED] Delete new record in GridPanel
Hi
I have problem deleting newly added rows in a GridPanel. It works great to add row and the delete works if I manually click the row then delete it.
But it does not work by clicking the "Delete" button directly after adding the row.
The problem is that for some reason the
Code:
var selection = App.gpPriser.getSelectionModel().getSelection()[0];
returns undefined. Any ideas of why this happens?
Add new row
Code:
var row = store.indexOf(store.insert(0, {})[0]);
Ext.defer(function () {
grid.editingPlugin.startEditByPosition({ row: row, column: 0 });
}, 100);
Delete button
Code:
var selection = App.gpPriser.getSelectionModel().getSelection()[0];
if (selection) {
App.gpPriser.store.remove(selection);
App.btnSparaPrisrad.fireEvent(App.btnSparaPrisrad.clickEvent); //sparar store, dvs raderar de rader som ska raderas mot databas
}
Best regards
Mikael