How to implement select/deselect all checkbox

726 views
Skip to first unread message

greengiant

unread,
Apr 25, 2011, 12:45:09 PM4/25/11
to KnockoutJS
I want to present a list of options to the user with a checkbox next
to each item to allow the user to indicate they would like to select
that item. I would also like to provide a "select/deselect all"
checkbox in the ui that when clicked with select all the items. What
is the best way to do that with knockout

Here is an example:
http://jsfiddle.net/greengiant83/awgph/

beic...@gmail.com

unread,
Apr 25, 2011, 12:59:09 PM4/25/11
to knock...@googlegroups.com
That sounds quite similar to a question that was posted a few days ago.  You may want to take a look at that discussion:
[nested dependent observables]
(https://groups.google.com/forum/#!topic/knockoutjs/5j1s5zg8ivg)

rpn

unread,
Apr 25, 2011, 9:34:06 PM4/25/11
to knock...@googlegroups.com
Here is one way that you could implement the "select/deselect all" scenario: http://jsfiddle.net/rniemeyer/kXYuU/

The model is slightly different to take advantage of how the checked binding can work with arrays, but you could make it work with your model as well.
Reply all
Reply to author
Forward
0 new messages