I'm trying to accomplish the following without the use of extra custom functions:
- Store selected items in a new array
- Only enable the textbox if its respective checkbox has been selected
- Keep track of updated values in new array
Below is a simplified sample of my code:
<div repeat.for="item of itemSearch.rates">
<input type="checkbox" ref="item.$index" model.bind="item" checked.bind="selectedRates">
<input type="text" disabled.bind="item.$index.checked == false" value.bind="item.total_value">
</div>
Currently, with the above, only the checked.bind
is working. Selected items are stored in my new selectedRates
array.
However my disabled.bind
is not being triggered at all.
If I remove checked.bind
from the checkbox, disabled.bind
works perfectly.
Also the updated values appear to pull through to the selectedRates
sometimes after submit and the elements have lost focus.
I'm aware that array observation is not officially supported as mentioned here, just something I noticed worth mentioning.
Questions
- Is there a way to get
checked.bind
to work along with theref
&disabled.bind
? - Any idea why I'm seeing this array observable-like behavior sometimes?
Update
I found the "observable values" issue to appear intermittently in firebug when logging the selectedRates
.
When displaying it in html, the value changes are always updated, with both @Fabio's use of the BindingEngine
implementation as well as my checked.bind
. Chrome always displays and logs the correct values.
Still no idea why, or if I should be concerned about this.