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(…)

XFaktorXFaktor Posts: 1Questions: 1Answers: 0
edited December 2016 in Free community support

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

  • allanallan Posts: 63,831Questions: 1Answers: 10,518 Site admin

    Not in DataTables as such. However, you could use the dataFilter option of jQuery to provide a function that will remove the null entry. The ajax option of DataTables is just passed to jQuery, so you could specify the function there.

    Allan

This discussion has been closed.