Answer the question
In order to leave comments, you need to log in
How to implement a dynamic data search algorithm (using extjs as an example)?
Hello!
I want to implement dynamic data search.
Those. when you enter text in the search bar, after each keystroke, an ajax request is created, which in turn accesses the database and pulls out the data.
So the algorithm is not complicated, you just hang up the request code on event.keyUp or event.keyPress and everything seems to be fine.
The problem comes when you start entering data very quickly. At some point, the request apparently does not have time to load and fails.
I make a request in the extjs javaScript framework and it looks something like this:
By pressing a key, it is checked that the length of the entered string is more than three and a letter or number is pressed
if (search_value.length > 3 && event.keyCode > 46 && event.keyCode < 91) {
store2.proxy.api.read = '/isc/get_store2/?value='+search_value;
store2.loadPage(1);
}
Answer the question
In order to leave comments, you need to log in
You need a delay between key presses. Here is a great code example.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question