How to find AJAX data with no column?
How to find AJAX data with no column?
andrew45
Posts: 24Questions: 8Answers: 0
Data is loaded to a Datatable as AJAX with a structure like {"id":"1","name":"a1","surname":"b1"},{"id":"2","name":"a2","surname":"b2"}, ...
But the Datatable has only 2 columns ("name" and "surname").
How to filter (search) to show only a row with id=1 ? I can't work this out because there is no column with "id".
This question has an accepted answers - jump to answer
Answers
It depends on how you want to search for the
id
. One option is to create a hidden column withcolumns.visible
for theid
. Another option is yo usesearch.fixed()
as a function. The second parameterdata
should contain theid
along with the other columns.Kevin
Thanks, Kevin. Your second link is 404, so this is a good one:
https://datatables.net/reference/api/search.fixed()
Yep its
search.fixed()
Kevin