javascript - search items that load data from DB in Knockout JS -


in application, have observablearray loads data db. observablearray fills first 25 items db , scrolled down loads 25 , goes on.

now, want implement search, should display result searching whole data db , not displayed 25 items.

i tried search result sending whole searching text db on clicking search button , there lot of datas in db takes time load data.

please let me know how can desired result db within ms. in advance.

to behaving search knockout, should extend searchtext observable bound input rate-limiter

this.searchtext = ko.observable('').extend({ ratelimit: { timeout: 500, method: "notifywhenchangesstop" } }) 

this call subscribers after input has remained unchanged 500ms (i.e. when user stops typing). use default method notifyatfixedrate call api @ least once every x seconds.

and top off, fiddle!

note: being said, if query taking 40 seconds, sounds problem database query. it's possible it's taking long because you're flooding server requests, still seems awfully slow. strategy use , works excellent, our api response time <200ms.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -