0

以下のViewとViewModelのコードと、データがビューにバインドされていない方法があります

http://jsfiddle.net/vZdJz/

データは特定の形式にする必要がありますか?

jsonが次の形式の場合はどうですか

{
  "0": {1,2,3},
  "1": {2,3,4},
  "2": {3,4,5},
  "3": {4,5,6}
}

次の配列の代わりに

[
  {1,2,3},
  {2,3,4},
  {3,4,5},
  {4,5,6}
]

どんな助けでも大歓迎です

4

1 に答える 1

0

Ok, so you have a few syntax errors. First, checkboxes need to use the checked binding, not the value binding. You also have an element with two data-bind attributes, which is invalid. Take a look at this fiddle to see a working version (I stripped out the unused properties, they were cluttering things). You should also note that binding a checkbox to an id property isn't going to make a lot of sense.

Note, I am using Knockout2.0, which jsfiddle has a framework for. I was still getting an error when using the latest version you were linking to. I wasn't able to figure out why, especially considering it works with 2.0.

于 2012-06-22T23:29:01.407 に答える