Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a dynamic selection list with content from the server

Tags:

knockout.js

I would like to achieve an effect similar to the 'Tags' input field of this web site where the user inputs some text and then is presented with options from the data store (assuming SO does not cache all tags on the client).

My current plan is to use something like the Chosen JavaScript plugin (http://harvesthq.github.io/chosen/) and bind the select element's options to an observable array containing the search results from the user input. So I would do the server query on two or three characters and let the JavaScript plugin do the filtering.

Is there any reason this won't work? Is there a simpler way to do it? Is there some sample code somewhere that I can use?

like image 875
dave walker Avatar asked Dec 29 '25 11:12

dave walker


1 Answers

There is no reason why this wouldn't work. Check out the throttle extender information from the knockoutjs website. It has some tips to get the best performance out of knockout when doing repeated user requested ajax calls.

like image 134
techsaint Avatar answered Jan 01 '26 12:01

techsaint



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!