Problems with searching
Problems with searching
_sid
Posts: 1Questions: 1Answers: 0
Hey folks!
I'm having some issues with the data table search. I'm using php with a raw select query. The table is populated correctly, but when I type anything in the search bar, nothing happens.
This is the json:
(
[iTotalRecords] => 2
[iTotalDisplayRecords] => 2
[list] => Array
(
[0] => Array
(
[id_application] => 1
[application] => test_application
[date_inserted] => 2021-04-08 21:38:44.276715
)
[1] => Array
(
[id_application] => 2
[application] => test_application_2
[date_inserted] => 2021-05-13 22:45:46.864623
)
)
)
This is the js
$('#list').dataTable({
"bProcessing": false,
"bServerSide": true,
"bAutoWidth": false,
ajax:{
url: url_+"index.php/application/data_table/",
dataSrc: 'list'
},
columns: [
{data: 'id_application'},
{data: 'application'},
{data: 'date_inserted'}
],
});
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This discussion has been closed.
Answers
From your JSON, it doesn't like it's returning the
draw
value - DataTables needs that to match the response to the request. The protocol is discussed here. Also see examples here.Cheers,
Colin