-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug with initial value when using naming template or foreach inside select tag #1243
Comments
The solution is to bind the inner content before the
http://jsfiddle.net/mbest/eHE9J/3/ I think it would be good to include a binding like this in Knockout and document this approach. |
In my Knockout fork, I set up the |
The example above appears to work with Knockout 2.3.0, but it still doesn't. http://jsfiddle.net/eHE9J/4/ Although the selection is set correctly, the model value has still been reset to |
I wonder if dynamically generating A sounder technique, I think, would be generating a data structure of options in your viewmodel as a Changing |
@SteveSanderson , yes, I created a computed observable with required options and used it with regular options binding. This is more natural way, and this way everything works perfectly. |
@SteveSanderson, Are you saying that we shouldn't support generating |
I want to use named template inside the <select> tag. The reason is my options have nested structure, so I call this template inside itself for each child recursively.
We can specify all options manually inside select tag, and this case <select> gets the properly value after initialization, here's the example: http://jsfiddle.net/eHE9J/.
But if we move options to any named template or even include foreach binding inside the select tag, initial value is dropped - it seems, foreach or template binding applied "after" the select initialization. Here's the example with named template: http://jsfiddle.net/eHE9J/1/, and here's it with foreach binding http://jsfiddle.net/eHE9J/2/.
The text was updated successfully, but these errors were encountered: