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
495
Unique key value when adding a row through javascript
posted

Hi There -

Working with the new WebDataGrid and I've damn near got it working the way I want.  I initially populate the grid with a stored procedure from a SQL table, and I've got AutoCrud turned off and Batch Update turned on.  I can add a new row using JavaScript, but the error I'm seeing in the debugger is because I'm not generating a new, unique primary key for my ID column which I've set as the DataKeyValue - its an integer field, and I'm guessing there's a way I can programatically roll through the grid and determine the max value, and add one to it, and use that as my key value when I call the grid.get_rows().add(row) method, just not sure how to go about it.

Thanks,

Jeff

p.s. this version of the grid control (11.2) is way uber-cool compared to the 6.2 version I have been working with.

Parents
  • 33839
    posted

    Hi Jeff,

    Glad to hear that you like the WebDataGrid.  If you add a row and do not give a DataKeyFields value in the new row, we should autogenerate a temporary one on the client.  Are you passing in null for that column or were you taking a guess?

    regards,
    David Young 

Reply Children