Completed
Last Updated: 12 Jun 2023 15:32 by ADMIN
Support
Created on: 06 Jun 2023 11:17
Category: Grid
Type: Feature Request
0
Allow kendo template in columns.attributes

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>

1 comment
ADMIN
Georgi Denchev
Posted on: 12 Jun 2023 15:32

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

As of R2 2023, the default icon type will be SVG instead of Font. See this blogpost for more information.