View Full Version : [CLOSED] enable dirty flag for new row added to grid

Sep 04, 2014, 9:58 PM
I found this http://forums.ext.net/showthread.php?17198-Adding-row-to-grid discussion and try to use grid.insertRecord(0, rec) got error method not found.
What is easiest way to do this ? (I can do on client or server side) I need show red falg for all cells and the store.getChangedData() or Store.dirty() should recognize this new row.


This is my JS handler when Add button is clicked:

var AddRow = function (grid, selectedKey, isCopy) {

url: '/Grid/AddRow',
params: {
gridid: gridid,
selectedKey: selectedKey,
isCopy: isCopy
success: function (response) {
var rec = Ext.decode(response.responseText).result;
grid.insertRecord(0, rec); // does not work
//grid.store.insert(0, rec); // not show red flag on each cell in new row




public ActionResult AddRow(int gridid, int selectedKey, bool isCopy)
var gModel = new GridModel();
DataRow obj = gModel.InsertNewDataRowToCache(gridid, selectedKey, isCopy);
return this.Direct(obj.RowObject.valuesStorage);


Sep 05, 2014, 7:36 AM
Hi @susanz,

I think a new record should be considered as a new one and be returned by the Store's .getChangedData() call.

Unless the "rec" variable contains the IDProperty field. Does it contain?

As for marking cells with a red flag. I think it is possible to do... Though, what about this way to mark new records?

Sep 05, 2014, 8:56 PM
Thanks a lots Daniil. I have one more question about IDProperty. I did not specify IDProperty and I don't have column "ID" either. Is it important to have it
or the store create one internally ?

Sep 06, 2014, 7:54 AM
I think having an IDProperty ModelField is quite important if you are going to save the edited, new, deleted records to the server data store.

IDProperty is "id" by default.

Sep 07, 2014, 2:13 AM
Thanks! My grid look good now. You can close this.