PDA

View Full Version : Editing grid: issue on selecting rows after record insertion



callipigia
17 Sep 2010, 7:20 AM
I use a grid with a RowEditor to read, update, create and destroy record.
Records are correctly inserted, updated and read from/to the server and are correctly displayed in the grid (one can modify inserted records or delete them).

However if a record is created and thereafter saved (calling store.save()) then if one selects it then such row can't be deselected any longer; so that record remains in a select state.

For inserted record the id property is correctly set and phantom, dirty are set to false.

The inserting row code is:



var store = lgrid.getStore();
var rt = store.recordType;
var r = new rt(lgrid.newRecord);
lgrid.initialConfig.plugins[lgrid.rowEditorPluginIdx].stopEditing();
store.insert(0, r);
lgrid.getView().refresh();
lgrid.getSelectionModel().selectRow(0);
lgrid.initialConfig.plugins[lgrid.rowEditorPluginIdx].startEditing(0);


when the user confirm changes (presses 'Update' button) it calls the function below:



'afteredit': function(me, changes, record, rowIndex) {
me.grid.getStore().save();
}


So, is there anything wrong with handling new records like above or is that a bug?

regards

callipigia
17 Sep 2010, 7:46 AM
I made some more checks and found out the problem is with the view: inserted record are correctly selected and deselected but the view doesn't update the selection state and keep showing inserted record as selected (gray) once it becomes selected for the very first time.