Unable to find row identifier issue

Unable to find row identifier issue

wwfisherwwfisher Posts: 3Questions: 1Answers: 0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

I'm receiving an unable to find row identifier issue when trying to edit rows that I've manually uploaded to a data file.

I'm using AJAX override for LocalStorage and I upload a json file with data in it and then also create new data rows once it uploaded.

The new data rows I create in the browser work fine and use the date generator to form unique DT_RowId values.

For the manual data I upload I generate a random unique 14 digit number and use that as the DT_RowId value.

Manual data rows with the unique random 14 digit number return the row identifier issue while rows generated in browser that generate their own DT_RowId have no issue.

I've tried overriding the unique row id to a different field using idSrc but no luck and have exported the data file and manipulated the DT_RowId to match the next sequential value to match the same pattern but this still doesn't like my non-browser generated DT_RowId.

I think its something obvious, I just can't put my finger on it.

All files exist locally on computer so can't give a working example but uploaded table configuration file to the debugger.

https://debug.datatables.net/ejoheg

Any help is greatly appreciated!

Cheers,

Answers

  • kthorngrenkthorngren Posts: 20,342Questions: 26Answers: 4,775

    How are you adding the new rows? If you are directly manipulating the HTML. table then see this FAQ for the Datatables supported options to update the table.

    Kevin

  • wwfisherwwfisher Posts: 3Questions: 1Answers: 0

    Thanks Kevin for the quick response. I had a quick check and I think I'm understanding where I'm running into issues.

    To import the data I'm just overriding the localstorage json file directly.

    I think this is saying that while that does import that data, datatables itself is having trouble recognising that i've just manually overridden the storage data file. So I'll probably have to destroy() the table and reinitialise with the API.

  • allanallan Posts: 61,762Questions: 1Answers: 10,111 Site admin

    datatables itself is having trouble recognising that i've just manually overridden the storage data file

    Not so much as having trouble doing so, but more just not doing so at all! I'm not aware of any "watch" methods that could be used to monitor changes to localStorage.

    You presumably know when you have updated the localStorage with your new data? Immediately after that you could use clear() to empty the existing rows from the table and then rows.add() to add the new rows. No need to destroy and recreate the table.

    Allan

  • wwfisherwwfisher Posts: 3Questions: 1Answers: 0

    Thanks Allan and Kevin,

    I've now tried a few different things to get this manipulated data from localStorage to be editable but am still running into the same row identifier issue.

    I've used both clear() and rows.add() simply attached to a button that I press after i change the localStorage data (this just puts me back to the initial state).

    I've tried a destroy() and then reinitialised a table, and this again leaves me back in the original state where, data created with editor is fine and editable, but data uploaded/edited in localStorage still returns:

    "Unable to find row identifier For more information, please refer to https://datatables.net/tn/14"

    Are there any other API functions I can use that will re assess the data source and repopulate the table editor?

  • kthorngrenkthorngren Posts: 20,342Questions: 26Answers: 4,775

    Please post your Datatables and Editor configs. Also post an example of the row data used with row.add().

    Kevin

Sign In or Register to comment.