Duplication of Cell IDs on setAttribute

I am inserting Cell IDs right before serialization:



Grid.cell_attrs=[“id”];

var i=1;

do{

if (!Grid.cells(i,0).getAttribute(“id”) ) {

Grid.cells(i,0).setAttribute(“id”,“ProductId”); }

i=i+1;

}

while(i<Grid.getRowsNum()+1);

Grid.setSerializationLevel(true,false);

Grid.xml.cell_attrs.push(“id”);

var xml = Grid.serialize();



How to check if Cell ID is inserted already for that particular Cell so I will not insert ID again?

I am using Grid.cells(i,0).getAttribute(“id”) for validation and trying to bypass the adding ID if ID is inserted already, but it’s still inserting ID again: ABC0003



Thanks.

The serialization must not dupplicate ID values, event if you have used setAttribute few times.
Please be sure that you ahve not called the next command few times
Grid.xml.cell_attrs.push(“id”);
Each time when itis called, it adds “id” attribute to list of serializable attributes, and each new adding cause duplication of attribute in output.


Serialization is duplicating the ID vakues. User case is: I am setting cell IDs when serializing grid data, then save this serialized data to DB. Then I call that data to grid again, do some cahnges in some cells, serialize data again and as result have ID duplications per each cell. Validation such as:  if (!Grid.cells(i,0).getAttribute(“id”) ) has nothing to do with  Grid.xml.cell_attrs.push(“id”);



Are there any alternatives for Grid.xml.cell_attrs.push(“id”) ?



thanks

Are there any alternatives for Grid.xml.cell_attrs.push(“id”) ?
Try to use
Grid.xml.cell_attrs=[“id”];