Unable to find row identifier
Unable to find row identifier
DominikFaust
Posts: 4Questions: 1Answers: 0
Hi,
i currently try to implement the data table (with editor). It works fine, but now i got an error "Unable to find row identifier". I'm new in java script and i have no idea why my code isnt working.
If i select an item and click the edit or delete button i got this error.
http://debug.datatables.net/odexev
Greatings
Dominik
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I presume that the unique identifier in each row is in your
Id
parameter? If so, use theidSrc
option to tell Editor that is where it is.Allan
Hi Allan,
based on this example, i dont need to set the idSrc. Or am i wrong?
https://editor.datatables.net/examples/advanced/REST.html
If i set the idSrc the same error occurs. Here is my complete data table.
Push
I had this same problem when first starting with Datatables. By default DT looks for
DT_RowId
to be returned in JSON from the server. Editor uses this field as the unique row ID. If you don't returnDT_RowId
then, like Allan mentioned, you will need to useidSrc: "Id"
in your Editor config.Kevin
Yup - what Kevin said!
DataTables has the ability to put DOM ids on rows automatically using the
rowId
option. By default that isDT_RowId
.Editor needs to be able to tell the server what row it is editing with a unique id. That is controlled by its
rowId
option - alsoDT_RowId
by default.Typically you would want to sent them both to be the same value.
The fact that you are using REST doesn't make any different to the id aspect. Editor still needs to be able to tell the server what row is being edited / deleted, and that comes from the id.
Allan
Now i got it. In my example i have to set both rowId and srcId to "Id" and it works. Thank you for your Help allen and kthrongren.