木構造のテーブルを作成したい。
行のjson配列があります。1 つの行に他の子行を含めることができます。
[
{
"Name": "Row 1",
"Depth": 1,
"Rows": [{ "Name": "Row 1.1", "Depth": 2, "Rows": [] }]
},
{
"Name":" Row 2",
"Depth": 1,
"Rows": []
}
]
私が行用に持っているテンプレート(これは機能しません)は次のようになります:
<script type="text/html" id="row-template">
<tr>
{{ for(var i = 1; i<= Depth; i++) { }}
<td class='col'></td>
{{/for}}
<td data-bind="text: Name"></td>
</tr>
</script>
n
ノックアウト テンプレート内で繰り返しステートメントを使用して、各行に必要な余分な列を追加する方法はありますか?