Alex Lord
asked on
Data-tables not bringing back exact results.
function getContacts(listId, cOnly) {
if (typeof contactTable !== 'undefined')
contactTable.destroy();
contactTable = $('#contactstable').DataTable({
"serverSide": true,
"stateSave": true,
"ordering": false,
"searching": true,
"oSearch": {"bSmart": false},
"searchDelay": 1500,
"ajax": {
"url": "get-contacts.php",
"type": "POST",
"data": {
listId: listId,
co: cOnly
}
},
"rowCallback": function (row, data) {
},
"initComplete": function (data) {
},
"columns": [
{"data": "contact"},
{"data": "email"},
{"data": "company"},
{"data": "date"},
{"data": "actions"}
],
'columnDefs' : [
{
'searchable' : false,
'targets' : [2,3,4]
}
],
"order": [[0, 'desc']]
});
}
so this function creates my dataTable,
all works table it up, i only perform search functions on contact and email,
how ever it is failing to give me exact results , for example first record is Tim Smith , i can clearly see Tim Smith, i type Tim Smith into the search input provided by data-tables, and he isnt shown in the result ?
https://datatables.net/
Pretty sure the actual search (filtering) will be done at your server-side script because you've set the datasource to AJAX, so to understand why it's not working, we'd need to see the get-contacts.php file
Hi,
Check if you have any html tag around the name.
The search and filter option supposed to work the same even if you use their server-side method, because it looking once the table is rendered...
Which Datatables version are you using?
Check if you have any html tag around the name.
The search and filter option supposed to work the same even if you use their server-side method, because it looking once the table is rendered...
Which Datatables version are you using?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
See here that is possible to search or filter data that are rendered using server-side
https://datatables.net/examples/server_side/simple.html
As long as the data you are looking for is in the datatables table
https://datatables.net/examples/server_side/simple.html
As long as the data you are looking for is in the datatables table