-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
options query do not replace option value in some situations #74
Comments
Ok. I will fix this. There are couple of issues with the new |
After thinking a bit about this issue I have a question: <select data-query="options(myOptions, {text:'text', value:'id'}).val(myVal)"></select> var myOptions = blocks.observable([{
id: '1',
text: 'Option 1'
}]);
var myVal = blocks.observable('1');
blocks.query({
myOptions: myOptions,
myVal: myVal
});
myOptions.reset([{
id: '42',
text: 'The answer to everything'
}]);
// Should 'myVal' now have the value 1 or 42 as the browser displays ?
// Currently the value would be 1 (even if the dom would get updated correctly). What do you think ? |
I think the selected item shouldn't be one that does not exist. In this case after reseting the Did you understand what I want to say? |
Yes. I think I've got it. |
Update will check for selected value inside the updated collection. Closes astoilkov#74.
Update will check for selected value inside the updated collection. And update the value to the first 'data-rel="header"' or when provided 'caption' option or otherwise to the first value of the collection. Closes astoilkov#74.
Update will check for selected value inside the updated collection. And update the value to the first 'data-rel="header"' or when provided 'caption' option or otherwise to the first value of the collection. Closes astoilkov#74.
Added update function to options-query fixes #74.
http://jsfiddle.net/3wagqq4h/2/
The text was updated successfully, but these errors were encountered: