Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
185
Update PrimaryKey after new row is added
posted

I have seen many posts about this. Some suggest to rebind the grid or  update the data-id cell thru script like RebindGrid as follows

//update new id to new row
function rebindGrid(data) {
if (typeof data.id != 'undefined') {
grid.igGridUpdating("setCellValue", recOldID, "id", parseInt(data.id));
$("#ba_addresses > tbody > tr[data-id='" + recOldID + "']").attr("data-id", data.AddressKey);
grid.data("igGrid").dataSource.commit();
grid.data("igGrid").dataSource.allTransactions().length = 0;
}
}
});

But Isn't there any other way fro solving this issue? Isn't there any update done to resolve it. 

  • 2525
    posted

    Hello Ashwini,

    This behavior can be achieved by handling the generatePrimaryKeyValue event. Within this event, the value contained within ui.value will correspond to the primary key of the newly added row.

    Let me know if you have any further questions.