How to implement sorting of columns with checkboxes with a datatable the has an add row feature
How to implement sorting of columns with checkboxes with a datatable the has an add row feature
Good Day!
I have implemented the sorting using this code
http://datatables.net/examples/plug-ins/dom_sort.html
But when I add a row an error will occur.
The scenario is that there are 2 rows currently in the table when I load the page everything is fine but when I add a new row
I get this error message
DataTables warning (table id = 'tble_China'): Requested unknown parameter '0' from the data source for row 2
This error message will occur if the current column being used for sorting has a checkbox in it.
And if the current used column for sorting is not using checkbox the add new row feature works fine.
Any inputs on what is the best approach to solve this error?
Thanks in advance
I have implemented the sorting using this code
http://datatables.net/examples/plug-ins/dom_sort.html
But when I add a row an error will occur.
The scenario is that there are 2 rows currently in the table when I load the page everything is fine but when I add a new row
I get this error message
DataTables warning (table id = 'tble_China'): Requested unknown parameter '0' from the data source for row 2
This error message will occur if the current column being used for sorting has a checkbox in it.
And if the current used column for sorting is not using checkbox the add new row feature works fine.
Any inputs on what is the best approach to solve this error?
Thanks in advance
This discussion has been closed.
Replies
Can you give us a link to the table please or at least run it through the debugger and give us a link to the debug code (after the error has occurred): http://debug.datatables.net .
Allan
By the way I do not know if this is related but the error occurs maybe because the new row is not yet present.
$.fn.dataTableExt.afnSortData will return lacking 1 row, the newly created row which is not yet created will not be included yet. So thats where the error starts.
What I did was a little hack I recorded when the users clicks the add row button then when $.fn.dataTableExt.afnSortData is invoked I will check a variable to know if the add row button was clicked, if yes then I will add the initial value of that column so that there will be no missing row returned by $.fn.dataTableExt.afnSortData