Allow using kendo templates in columns.attributes for example
<div id="grid"></div>
<script>
$("#grid").kendoGrid({
columns: [ {
field: "name",
title: "Name",
attributes: {
"data-id": "#:data.id#",
"data-clientid": "#:data.clientId#",
}
} ],
dataSource: [ { id:1, name: "Jane Doe", clientId:"#223" }, { id:2, name: "John Doe", clientId:"#354" }]
});
</script>
Hello,
This is already possible, please refer to the second example in the columns.attributes documentation:
<div id="grid"></div>
<script>
let ageAttributes = (data) => {
return { style: `background-color: ${data.color} ` }
}
$("#grid").kendoGrid({
columns: [
{
field: "name",
title: "Name",
attributes: { "class": "table-cell !k-text-right" }
},
{
field: "age",
title: "Age",
attributes: ageAttributes
}
],
dataSource: [
{ name: "Anne Smith", age: 30, color: "#FFD68A" },
{ name: "John Doe", age: 22, color: "#B2AC88" }
]
});
</script>
Best Regards,
Georgi Denchev
Progress Telerik