I have a grid where for newly created items I autoincrement the ID field like this:
The problem I am having is when I call addRow() the UID is generated based on an ID of 0, and not the ID that I create in the onChange event. This causes problems when trying do a dataSource.get(ID)...
Any hints? This is making other operations on my grid impossible.
// use this to handle auto-increment for new rows
var current = -1;
function onChange(e) {
if (e.action == "add") {
var item = e.items[0];
item.ID = current;
current -= 1;
}
}
The problem I am having is when I call addRow() the UID is generated based on an ID of 0, and not the ID that I create in the onChange event. This causes problems when trying do a dataSource.get(ID)...
// ID = -1
var item = dataSource.get(ID);
// UID = undefined because the UID was generated thinking it was an ID of 0, not -1
var uid = item.uid;
Any hints? This is making other operations on my grid impossible.