idSrc not working
idSrc not working
Obviously, in Version 1.5 of dataTable Editor the idSrc option is not working, not even on the official example page:
https://editor.datatables.net/examples/advanced/jsonId.html
The <TR> code does not contain the id field (taken from the browser source of the example above):
<tr class="odd" role="row"><td class="sorting_1">Airi Satou</td><td>Accountant</td><td>Tokyo</td><td>5407</td><td>2008-11-28</td><td>$162,700</td></tr>
Any idea what went wrong?
Thanks for your help,
Denis
This question has an accepted answers - jump to answer
Answers
Update:
Trying further with the online example (link in my initial post) it seems that the id property of the <tr> tag is only set after updating a record. It is not set right after initialization and just showing the dataTable.
Is there any way to get the id also set without having modified the record?
Thanks, Denis
Hi Denis,
Editor's
idSrcoption does not set the row node's id - DataTables'rowIddoes that.Editor doesn't need to read the id from the row id, it can read it from any property, which is what its
idSrcoption is for. So in fact, the example is operating as expected since it reads the id from theidparameter in the JSON data source.If you need the row id to be set, use the
rowIdoption.Regards,
Allan
Allan,
Thank you such much for your quick reply.
The suggested approach works perfectly.
Best regards,
Denis