I have a DataTable which has multiple columns and the sorting function works correctly for all columns except one.
For the column which doesn't work, I am adding the values to the table later on after doing a lazy fetch after a user action, whereas all other values in the columns are loaded when the table is rendered.
Is there a way for the table to get to know the latest values so that the new column can be sorted as well. To add text to the column I use the .text
function of Jquery.
The cell().invalidate() function https://datatables.net/reference/api/cell().invalidate()
or row().invalidate() function https://datatables.net/reference/api/row().invalidate()
Might be useful, if called in your callback from your Lazy Fetch.
so I used the datatables rows every function to loop through all the rows in the table. I get the Id which is column 0 and compare it to the id in the lazy loaded JSON data. if it matches I update cell[4] the age column.
run the fiddle below and click the load ages button. even if you sorted it, it should correctly get the ages in there, and they should be sortable.