I'd like to build a grid of divs.
I have an array of arrays, like this:
[
[
{
"value": "0"},
{
"value": "1",
}
]
]
(Sorry, but I can't indent the code properly in the editor.)
I can't do it with MVVM.
This is how I do it:
Template container:
<div data-bind="source: matrix" data-template="frame-cells-row-tmpl">
</div>
Template row:
<script type="text/x-kendo-template" id="frame-cells-row-tmpl">
<div class="frame-grid-row" data-bind="source: data" data-template="frame-cells-col-tmpl">
</div>
</script>
Template col:
<script type="text/x-kendo-template" id="frame-cells-col-tmpl">
<div class="frame-grid-col">
#: value #
</div>
</script>
The error I get is:
It works fine if I do this:
<script type="text/x-kendo-template" id="frame-cells-row-tmpl">
<div class="frame-grid-row" >
## for(var i=0; i < data.length; i++) { ##
<div class="frame-grid-cell">
##= data[i].value ##
</div>
## } ##
</div>
</script>
Why can't I use MVVM?
In the "row" template, is "data" the correct variable name for "source"?Many thanks!