I am binding to a table using a template. The number of columns is dynamic. My data source row looks like this:
The flags array length is the same for all rows. My desired output is something like this:
I have tried using a nested template to generate the <td> elements for each of the array items, but the problem is that this requires a containing element to apply against, as in the made up "xxx" element below:
I've also tried flattening out the data source:
But with this approach, I can't find a way to render the first array item differently than the remaining.
Can you advise how this problem should be addressed?
Thanks,
Gary
{ name:
"text"
, flags: [ {status:
true
}, {status:
false
}, {status:
false
} ] }
<
tr
>
<
td
data-bind
=
"html: name"
></
td
>
<
td
><
input
type
=
"checkbox"
data-bind
=
"check: status"
/></
td
>
<
td
><
input
type
=
"checkbox"
data-bind
=
"check: status"
/></
td
>
<
td
><
input
type
=
"checkbox"
data-bind
=
"check: status"
/></
td
>
</
tr
>
<script id=
"row-template"
type=
"text/x-kendo-template"
>
<tr>
<td data-bind=
"html: name"
></td>
<xxx data-template=
"flags-template"
data-bind=
"source: flags"
></xxx>
</tr>
</script>
<script id=
"statuses-template"
type=
"text/x-kendo-template"
>
<td><input type=
"checkbox"
data-bind=
"checked: status"
/></td>
</script>
[ {name:
"text"}, {
status:
true}
, {status:
false
}, {status:
false
} ]
Can you advise how this problem should be addressed?
Thanks,
Gary