Tyler DeWitt
Tyler DeWitt

Reputation: 23576

Knockout JS List Selection Extremely Slow

I've got a drop down list of 2,000 items. If I use knockout JS to build this list, things are fine. When I set the value tag in the list, however, the list becomes super slow to respond (3 seconds to update the selected item).

Is this expected?

<select id="schoolName" data-bind="options: schools, value: selectedSchool, optionsText: 'CommonName'">
</select>

It only happens when I have the value tag inserted (which I need, because I need the value of the selected item).

Thanks

Upvotes: 1

Views: 1015

Answers (1)

photo_tom
photo_tom

Reputation: 7342

With 2000 items, you definitely want an autocomplete. There is discussion on how to autocomplete in google groups (https://groups.google.com/forum/#!starred/knockoutjs/ABhEeI7jLKA).

RPN has a fiddle at http://jsfiddle.net/rniemeyer/YNCTY/ that shows an autocomplete custom knockout binding. I just implemented the ajax version of this today and it works really, really well.

Upvotes: 2

Related Questions