Oct 31, 2014, 1:47 AM
[CLOSED] Add new row to grid (dirty is false)
I have a complex grid. I want to add a new row but I want the row to be "not-dirty" and the state of the grid not dirty.
Therefore if I click grid.save(), it should be a no-op.
I poked through the forums but didn't see what I needed. The code below is what I use to add a new row AND mark the row and any changed cell as dirty
Thanks,
/Z
Therefore if I click grid.save(), it should be a no-op.
I poked through the forums but didn't see what I needed. The code below is what I use to add a new row AND mark the row and any changed cell as dirty
Thanks,
/Z
var generateNewRow = function (command, rowData, grid, record) {
rowInsertCounter -= 1;
var rowIndex = index = grid.store.indexOf(record);
var newRecord = {
id: a, b: rowData.b, c: rowData.c
};
//persisted and dirty!
var totalCount = grid.store.getCount() + grid.store.modified.length;
if (rowIndex == totalCount - 1) {
grid.addRecord(newRecord);
} else {
grid.insertRecord(rowIndex + 1, newRecord);
}
var recordAdded = grid.store.getById(rowInsertCounter);
recordAdded.phantom = true;
grid.render();
return rowIndex;
};
Last edited by Daniil; Nov 07, 2014 at 4:01 AM.
Reason: [CLOSED]