Custom search filter
Custom search filter
nicontrols
Posts: 32Questions: 16Answers: 1
I've added the following code before $(document).ready:
$.fn.dataTable.ext.search.push(
function( settings, searchData, index, rowData, counter ) {
return false;
}
);
I don't see any errors in the console log, but it has no affect on the table whatsoever, I was expecting my table to show zero results.
I can't seem to get $.fn.dataTable.ext.search.push to do anything at all...
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
It works here:
http://live.datatables.net/rahayoni/1/edit
Maybe you can update my example to replicate your issue.
Kevin
I use this stuff all the time and it works. I guess you need to put it on top of your table definition but after $(document).ready.
Have you tried that?
I’ve tried adding it within the document ready without any luck. I see the example provided works just how I want mine too.
Is it possible that because my data table gets its data server side it ignores the custom filter?
I am pretty sure that this is true!
All filtering is done on the server for server side. Why don't you turn off server side for a moment and figure it out?
Or maybe this is a complete misunderstanding?
When I speak about "server side" I mean the Editor mode "server side". As opposed to not having Editor "server side" turned on. Either way: The data come from the server. I think you need to turn Editor "server side" off and then it should work. just give it a try.
The search plugin is a client side search mechanism.
Not sure exactly what you want to do but maybe the
ajax.data
option can help. Haven't tested this but maybe you can send a boolean value to the server script indicting whether to run normally or to return 0 rows and indicaterecordsFiltered
of 0 andrecordsTotal
would be the normal total records.Kevin