altRowTemplate String|Function
The template which renders the alternating table rows. Be default the grid renders a table row (<tr>
) for every data source item.
The outermost HTML element in the template must be a table row (
<tr>
). That table row must have theuid
data attribute set to${uid}
. The grid uses theuid
data attribute to determine the data to which a table row is bound to. Set theclass
of the table row tok-alt
to get the default "alternating" look and feel.
Example - specify alternating row template
<div id="grid"></div>
<script>
let encode = kendo.htmlEncode;
$("#grid").kendoGrid({
dataSource: [ { name: "Jane Doe", age: 30 }, { name: "John Doe", age: 33 } ],
altRowTemplate: ({ uid, name, age }) => `<tr data-uid="${uid}"><td colspan="2"><strong>${encode(name)} - </strong><strong>${encode(age)}</strong></td></tr>`
});
</script>