Background:
When the equivalent of javascript blur happens, I want to be able to edit the selectedOptions bound to a select list through knockout. For instance, select a specific element from a list, or clear the selection.
I found this topic which suggests two methods of implementing the "blur" part.
I would prefer to use the solution offered by Chris Pratt, as the system involves a lot of generated code, and it is much simpler if I don't have to change the knockout portion of it. All of my attempts so far have been using Chris Pratt's solution.
In my javascript, I am getting a handle on the relevant DOM elements with no problems. However, I am having difficulties getting a handle on the selectedOptions koobservablearray which is bound to the select. When I call ko.dataFor(DOMobject), it seems to return functions which return regular javascript arrays which are copies of my koobservablearrays, meaning that I can't edit them in order to change which option is selected.
Question:
So, is it possible to achieve what I am trying to do from "outside" of knockout, using methods like ko.dataFor or ko.contextFor? How are these methods intended to work? What are they good for?
Thanks!