Retrieve value of newly created row
Retrieve value of newly created row
With editor 1.4, I managed to do this in my ajax page, using the code below...
if ( isset($_POST['action']) && $_POST['action'] === 'create' ) {
$rowid = ltrim($data['row']['DT_RowId'],'row_');
}
Now i am using 1.5.1, this doesn't work for me anymore.
I have tried followng the example and this post...
https://datatables.net/forums/discussion/25609/retrieving-the-mysql-id-for-a-newly-created-row
but i can't seem to get the syntax right.
would appreciate any help
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Ok, fumbled may way to it
for 1.5.1, the syntax i used is
1.5 added support for multiple updates. I think the "legacyajax" option adds support for the previous syntax, based on a single record update.
Thanks Thom
I did see that, but wanted to update to the new syntax.
the solution I offered in the second post works ok for create, but now i am having trouble with delete.
on my ajax source page, i want to delete rows from a related table when a row is removed from my parent table. with 1.4 it was straightforward
with 1.5, i have tried using a php array function to get the key and extract the row id from that
Is that the best way ?
Server-side events in 1.5 might actually be the best way.
Alternatively you could parse the new data format (as you are doing) and that will also work - so yes, the
array_keys
method you have used is the best way if you want to do it like that.Allan