Row show/hide locally on server side query
Row show/hide locally on server side query
GeorgeHelmke
Posts: 44Questions: 16Answers: 0
Here a peach for you:
I am getting records from a server side ajax query.
The user then has 50 or so records to stare at.
I want them to have a button that limits the amount of records shown , without having to do another server hit. It just goes through the table, and hides/shows existing rows based on criteria I set up.
I have tried $.fn.dataTableExt.afnFilter.push( blah blah blah.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
That is critical - what is that criteria? You could potentially use
search()
orcolumn().search()
for simple logic for example.Are you using server-side processing or client-side processing (
serverSide
)? With server-side, every draw will always cause an Ajax request in DataTables, there is no way around that as it is designed that way.Allan
Server side - so I'll sort that out myself with the tools I have. Thanks for a firm answer, nothing better than that.
Criteria. The first I did was just try to make all rows disappear:
$.fn.dataTableExt.afnFiltering.push(
function (settings, data, dataIndex) {
return false;
}
Here are the definitions to set context:
Since you are using server-side processing the custom filtering functions in
$.fn.dataTableExt.afnFiltering
shouldn't even be called. The reason for that is that in server-side processing mode, filtering is entirely done by the server.Regards,
Allan