【发布时间】:2013-02-21 15:22:50
【问题描述】:
我有一个模型,其中包含 2 个类型和名称地址等数组,如下所示:
var model = [{"bstype":1},{"bstype":2},{"bstype":3},{"bstype":4}],
[{"bstype":1, "name":"John","Address":"Sample address"},
[{"bstype":1, "name":"John","Address":"Sample address"},
[{"bstype":3, "name":"John","Address":"Sample address"},
{"bstype":2 ,"name":"John","Address":"Sample address"}];
[{"bstype":2, "name":"John","Address":"Sample address"},
[{"bstype":4, "name":"John","Address":"Sample address"}];
我想要它做的是创建一个列表:
类似
I am not sure about this part how to implement it that is why it was gibberish.
bstype":1 will have a view of following
[{"bstype":1, "name":"John","Address":"Sample address"},
[{"bstype":1, "name":"John","Address":"Sample address"},
bstype"2: will have a view of following
{"bstype":2 ,"name":"John","Address":"Sample address"}];
[{"bstype":2, "name":"John","Address":"Sample address"},
bstype":3 has only one
[{"bstype":3, "name":"John","Address":"Sample address"},
以此类推。
我正在使用淘汰赛我已经检查了它只讨论了 foreach 但没有讨论如何访问子元素的网站。
我希望这是有道理的。
谢谢
【问题讨论】:
-
你的例子中的语法没有意义......你已经定义了一个列表,然后是一堆东西。您能否解决此问题,以便我们更清楚地了解您正在处理的内容?
标签: knockout.js knockout-mapping-plugin knockout-2.0 knockout-mvc knockout-sortable