server-side with Individual column searching (text inputs)
server-side with Individual column searching (text inputs)
Hello,
I use server side and I want to add 'Individual column searching (text inputs)' like
https://www.datatables.net/examples/api/multi_filter.html
It seems basic, but, when i enter a keyword, it makes several draw, so several ajax request instead of one. (same number of request os number of columns) and my keyword is sent into each column in the request.
Is anyone have an idea?
Regards,
Rodolphe
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi Rodolphe,
It sounds like what might be happening is that the event handler is being bound to all inputs on every iteration of the loop that is being used to assign it in the first place.
I've created this little example which demonstrates how it might be done: http://live.datatables.net/piqidoqo/1/edit . One key element is to use the
initComplete
callback - this is important for Ajax sourced tables since they are of course asynchronous by definition.Allan
You can also check my yadcf plugin for datatables , here is the server side showcase page among others it have lots of filter types, filter_delay and many more options.
Hi Allan,
Ahhh... Thank you very much, it works!!
Best regards,
This works, but it still seems to fire an event for every column in the table when a single search value changes. I'm using a Servlet to filter data on the server side.
Hello,
Allan's solution work fine with me, it fires only one request.
I change this to do only one request by keywork and not at each letter :
Regards,
Rodolphe
@daniel_r I didn't succeed to implement your plugin normally.
What I liked is that it works in pair with standard search, complementing it. An "AND" condition.
I had problems with visualization. I downloaded several jQuery plugins, while tried to make it work.
But how it works on your page, the functionality itself, is amazing!!
I will start now implementing bootstrap-selectpicker (it looks great) with multiselect as a dropdown for the fields. I think I will take coding lessons from your plugin. Thanks for your work!
@musinik, thanks, yadcf provides api for easy integration with any third party select plugin. And all the source code of the yadcf plugin and the showcase are available on github.