次のように、タイプと名前アドレスなどの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についてのみ説明しており、子要素へのアクセス方法については説明していません。
これが理にかなっていることを願っています。
ありがとう