I have a problem when binding a list of complex values (id/ description) to a list of checkboxes.
The problem is that I need not just the id or the description, but both.
When I bind using the Checked binding, all the checkboxes in my list are checked when I click one item.
This is part of something bigger, and the reason I want the object and not just the id is that the complex type in turn will have a list which I want to bind to another list of checkboxes.
Here is a fiddle that produces the problem: http://jsfiddle.net/M8KFd/1
Thankful for your help.
I track the state of each item individually, then get the selected items using a dependent observable something like this
A simpler solution, is to fake the checkbox with css, then with knockout just call a method which will pass the whole item to the viewmodel:
Of course this does not work for all scenarios as per Richard Friend's answer.