Server-side processing: minimum search string length?
Server-side processing: minimum search string length?

I've seen a number of design cases in a web page where a user is required to type at least 3-5 characters in the search field before a list of results is produced. Typically this is when there are a lot of rows and it makes no sense to search for just "A" or load all records initially with no search string.
Has anyone implemented server-side functionality with a minimum search string length? Doesn't appear to already be an option for this.
This question has an accepted answers - jump to answer
Answers
While not exactly what you are asking for there is the
searchDelay
option that might be useful.Otherwise you can take over the global search keyup event and create your own that will search after X number of characters. You would use
search()
for this. Or you can remove the default search input using thedom
option and create your own that does the above.Kevin
Thanks, that's more or less what I was expecting would have to be done. I was just hoping someone might already have an example.
Here is an example of taking over the default search input:
http://live.datatables.net/jorexujo/1/edit
It simply searches each keyup. I think all it would take is an IF statement to determine if the search should be executed for each keystroke.
Kevin
Thinking about you would need to would need to come up with a way to perform the search if the user doesn't type X characters. There may be good options found on Stack Overflow. It would be easier to implement the
searchDelay
option.Kevin
In our use case no search needs happen until user enters the MIN search chars. I don't love the idea of taking over "keyup" but I guess that's about the only option. We decided to live without this feature for this situation.