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
195
Updating ID (primary key) after adding row with Knockout datasource
posted

Hi

I don't want to use the generated ID because it is wrong most of the times. I have the ASP.NET api returning the created ID and want to update it in the grid afterwards.

editCellStarted = function (evt, ui) {
    if (ui.rowAdding && ui.columnKey === 'ID') {
    ui.editor.igEditor("value", -1);
  }
};

The code above works fine, although I don't know if this is the right way to do it.

Using the following code I try to update the ID to the value returned via the AJAX call.

$("#grid1").igGridUpdating("setCellValue", ui.rowID, "ID", data);

It does actually work, but in the console the following error appears: "TypeError: can't convert null to object". Changing another value (string/currency value) works fine.

Is there a work around or something to solve this?

Parents
No Data
Reply Children