zrbecker
zrbecker

Reputation: 1592

Knockout checkedValue keeps being set to "on"

In the following code pVM.People and pVM.PeopleSelected are observable arrays.

<tbody data-bind="foreach: pVM.People">
  <tr>
    <td><input type="checkbox" data-bind="checkedValue: $data, checked: pVM.PeopleSelected" /></td>
    <td data-bind="text: $data.Name"></td>
  </tr>
<tbody>

When I check a box, all the boxes get selected, and if I look into the chrome javascript console, my array prints ["on"] instead of having the objects in the list pVM.People.

I made a small thing in JSFiddle and the code works fine, so I know there is something more complex going on that is not being represented in the above code. However, the application is very large, and I am not even sure what to look for.

Can anyone point me in the right direction on why the objects are being converted to "on" when I check the boxes?

Upvotes: 1

Views: 106

Answers (1)

zrbecker
zrbecker

Reputation: 1592

I was using the wrong version of knockout. In knockout 2.3.0 apparently my solution above does not work.

Upvotes: 1

Related Questions