Best Approach to Saving Datatable data

Hi,

I am currently using .php scripts to handle the loading/saving of data in my datatable. In php I am connection to SQL Server so the lastInsertRowId() does not work. I could re-query the table and return the new key but I’m not sure how I then pass this back to the datatable? I used the php scripts that come with the samples as a starting point.

At the moment I am doing a

.add(data);
.clearAll();
.load(<data_url>);

which does work but re-draws the whole grid on the page so not ideal from a UI point of view.

Thanks

Gary

The php script, which saves the data must return something like

{ id:"new id "}

where id contains a new id of just inserted record. In case o MsSQL, you can use “SELECT @@IDENTITY AS new_id” to get the last created ID.