-
Notifications
You must be signed in to change notification settings - Fork 59
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
Data binding on select
element
#23
Comments
For a
If you set an non-existent value it should just not select an One really nice feature which I haven't seen in other libraries is support for the disabled attribute, which could be another value in the data array. |
|
I agree with greginns points, also I would like to bind to an array of objects with "key"/"value" properties. Showing the value and binding on the key. Would this be possible? |
Change this: |
Also change this: |
The change isn't as simple as that. Sure, it fixes the options being set via an array, but then the value (in bind) is coersed from the array to a string. These suggested changes half work (missing tests tho), but it raises the larger question: is bind.js okay with the value type magically changing? |
I agree with you. |
Hi the issue with select element in lib file it working fine with https://cdn.rawgit.com/remy/bind/928c52ce335d6fd2c824b536a97efa460554b9e0/dist/bind.min.js seems something breaking in non-minified version |
Just a heads up... There were two issues I had which I was able to fix: (bind.js not the minified version)
This should be changed to var event = { The issue is that the type of a node SELECT is actually 'select-one'... if 'select-one' is not in quotes, the script will break due to the hyphen. Be sure to include the hyphen. If you are manually changing the minified version the section I would be talking out is referenced as: i={ checkbox:"change",radio:"change"}[n.type] and should be changed to i={'select-one': "change", checkbox:"change",radio:"change"}[n.type] |
A few issues have been raised about
select
elements not working, and it's definitely right, I started to look at the issue and it raises some questions.It sort of makes sense that if the bound object is an array, each element in the array would be an
option
element. However, the point of changing the value of aselect
is to set the value of theselect
not particularly change the values.This kind of goes against how bind.js works, since you might think the closest comparison is the
ul
element, however, when the array is changed against theul
, the contents of theul
changes entirely.I feel like the callback to the bound object in the case of a
select
, should give the new set value.Issues around this are:
option
list of theselect
element?select
from the bound object? If so, I can't see how without a feature change.For reference, this is what a
ul
data binding looks like:The text was updated successfully, but these errors were encountered: