Example of Column Template in ASP.NET Core Tree Grid Control
This sample demonstrates the usage of template columns in TreeGrid. In this sample, we have shown SparkLine control in TreeGrid columns.
Employee ID | Name | DOB | Tax per annum | One day index | Year GR |
---|---|---|---|---|---|
EMP001 | Robert King | 2/15/1963 | |||
EMP004 | David william | 5/20/1971 | |||
EMP035 | Nancy Davolio | 3/19/1966 | |||
EMP045 | Andrew Fuller | 9/20/1980 | |||
EMP091 | Anne Dodsworth | 10/19/1989 | |||
EMP110 | Michael Suyama | 11/2/1987 | |||
EMP131 | Janet Leverling | 11/6/1090 | |||
EMP039 | Romey Wilson | 2/2/1980 | |||
EMP213 | Margaret Peacock | 1/21/1986 | |||
EMP197 | Steven Buchanan | 3/23/1987 | |||
EMP167 | Tedd Lawson | 8/9/1989 |
The TreeGrid provides a way to use a custom layout for each cell using column template feature.
The columns->template
property accepts either string or HTML element`s ID value, which will be used as the template for the cell.
In this demo, using column template, we have presented sparkLine charts for the "Tax per annum", "One day index" and "Year GR" columns. In columns->template
we have assigned with the ID of a SCRIPT element whose content is used as the template.
The template expression should be provided inside ${...}
interpolation syntax
More information on the data binding can be found in this documentation section.