Minimum number of characters in search field
Minimum number of characters in search field
Hi,
I am looking for a smart solution to configure the search field in a way that a request is not triggered until a certain number of characters have been filled in to reduce the server load. I assume this can be accomplished with one of the callback functions but I can't figure it out.
Thanks in advance for a hint and a huge thank you to the author of datatables for this awsome piece of code.
Best regards,
Bjoern
I am looking for a smart solution to configure the search field in a way that a request is not triggered until a certain number of characters have been filled in to reduce the server load. I assume this can be accomplished with one of the callback functions but I can't figure it out.
Thanks in advance for a hint and a huge thank you to the author of datatables for this awsome piece of code.
Best regards,
Bjoern
This discussion has been closed.
Replies
I knew when I posted this comment earlier I had forgotten one form of manipulation for the filtering input: http://datatables.net/forums/discussion/7580/button-search#Item_2 :-)
Basically what you need to do (either wrapped up in an API plug-in, which would be nice!, or otherwise) is to unbind the keyup event that DataTables uses by default for the filtering input, and then bind your own that will call fnFilter when the length of the input is >=3 (or whatever).
The filter on return plug-in ( http://datatables.net/plug-ins/api#fnFilterOnReturn ) shows a nice way of doing the majority of that.
Allan