Inline editing of DataTable without JSON key information
Inline editing of DataTable without JSON key information
Hallo,
I have a table filled by a JSON array of arrays, the primary key being the first field, and I am attempting to use inline editing.
The examples I have found use a JSON array of objects, the key of which is used to select the datum to be edited when clicking on a field.
I end up with a "Uncaught Unable to find row identifier For more information, please refer to https://datatables.net/tn/14". Which I have read attentively.
I have added as idSrc
the fieldName value of the first Editor column, to no avail.
Is there a way of adding the datum key information or fieldName matching info to the columns
of the dataTable?
Thanks in advance
George
Replies
Can you post a snippet of what you did?
The
idSrc
docs state this for array data:Kevin
Hallo, Kevin,
Well spotted and thank you. I'd missed that. It works.
(BTW is there some way for users to fix or suggest fixes for a typo?)
But there is another problem: the editor field input comes up blank, instead of being seeded with the value in the DataTable.
Any ideas?
George
Post the link and the suggested changes in this or a new thread.
See if this example with arrays helps. If not please update it or provide a link to your page or a test case showing the issue.
http://live.datatables.net/vagapezu/23/edit
Kevin
Magnificent!
It all works perfectly.
May I suggest adding this to your official examples? Adding all ine array index numbers as names in 2 places was a little short of obvious.
Thanks again
George
Oh, and the typo is "form" instead of "from" in the integer box at the top of the
idSrc
reference page https://editor.datatables.net/reference/option/idSrcOver to you
Thanks for pointing out the typo - I've got it fixed in our git repo for the site and will push it out soon.
Regarding the suggestion of an example with arrays of data for Editor. I actually thought we did have one, but I suspect that might have been from a legacy version. We find that developers can keep track of data much easier with object properties rather than arrays, where it easy to mix indexes if you add or remove columns, but yes, it probably would be worth having a single example of how this can be done.
Many thanks to Kevin for your example. You are a Titan of the DataTables world sir.
Allan