Need some help with null values : Uncaught TypeError: Cannot read property 'DT_RowId' of null(…)
Need some help with null values : Uncaught TypeError: Cannot read property 'DT_RowId' of null(…)
Hi,
Have a datatables that work quite well 99% of the time.
Usual response from the server side ajax call.
{"draw":5,"recordsTotal":6646,"recordsFiltered":6646,"data":[["Singapore","xxx","xxx",""],["Uzbekistan","xxx","xxx",""],["Botswana","xxx","xxx",""],["San Marino","xxx","xxx",""],["Ethiopia","xxx","xxx",""]]}
But on the last page of pagination the the number is not equal - so it returns null at some of the data places.
{"draw":6,"recordsTotal":6646,"recordsFiltered":6646,"data":[["Uganda","xxx","xxx",""],null,null,null,null]}
Question - is there is easy way to make it work regardless - by not showing null values and showing only viable ones ?
Without changing ajax responses in server side ?
Answers
Not in DataTables as such. However, you could use the
dataFilter
option of jQuery to provide a function that will remove the null entry. Theajax
option of DataTables is just passed to jQuery, so you could specify the function there.Allan