-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Model and view gets out of sync with checkboxes #686
Comments
here is a working version: http://jsfiddle.net/mmH63/4/ In a strange way this is kind of makes sense, but it is not what you want. Not exactly sure how to fix that. 2011/12/7 Henrik Jørgensen <
|
But the thing is - it worked in the 0.10.2 release: http://jsfiddle.net/hekke/mmH63/6/ In 0.10.3+ there's only a problem when looping over the same array as I'm indexing into. It's easy to work araound, but what scares me is what else is lurking behind this odd behavior. For an updated 0.10.3+ example, see: |
it worked because 0.10.3 did not have stable repeaters and so it was not effected by this issue. Stable repeaters is a feature which keeps the array you are iterating over and the elements in sync, which means that adding an object in the middle of the array will cause a new element to be added to DOM at the same position. But if you have an array such as [true, true], and you change it to [true, false] it is not clear what just happened and how should the DOM behave. |
That makes sense. I'm content with that explanation. |
http://jsfiddle.net/hekke/mmH63/2/
Try clicking the first checkbox - it marks both the first and second as checked, but the model is ok.
Tested in Chrome 15 and Firefox 8
Edit: updated the fiddle with loop over a different array. Then it works??
The text was updated successfully, but these errors were encountered: