我有一个包含类型和名称地址2门阵列等等如下模型:Knockoutjs有关的foreach孩子父母
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但不知道如何访问子元素。
我希望这是有道理的。
由于
你的例子中的语法没有意义......你已经定义了一个列表,然后是一堆东西。你能解决这个问题吗?这样我们可以更清楚地看到你在做什么? – bdesham 2013-03-06 17:34:50