BorisMoore / jsviews

Interactive data-driven views, MVVM and MVP, built on top of JsRender templates
http://www.jsviews.com/#jsviews
MIT License
855 stars 130 forks source link

Observing length of checked checkboxes #435

Closed Dissolubilis closed 5 years ago

Dissolubilis commented 5 years ago

Hello I need to know how much data-linked checkboxes are checked, however its length doesn't change on any checkbox checking. Example - https://jsfiddle.net/egmk875o/ . Is there anything I can do to make it work?

BorisMoore commented 5 years ago

When the user modifies the selection of checked checkboxes, the data property is observably replaced by a new array. This means that in order to observe the length of the array, you need to use a deep path, such as {^{:checked^length}} in your example.

Dissolubilis commented 5 years ago

Thank you, it works like charm now! (fixed example https://jsfiddle.net/15aj2tq0/)