I have a datatable that is bind to a form. When I update the record it works fine but if I try to update the same record I get an “Attempt to change ID in updateItem”. I assume that it is because it trying to update the ID field that is already generated. A work around for it was to unset the array “id” after the variable has been set. Is there a better way of doing the below?
var Datatable = $$('table');
var Selected = Datatable.getSelectedId();
if (!Selected) return;
var FormData = $$('myform').getValues();
delete FormData['id'];
Datatable.updateItem(Selected, FormData);