Like the title says, I am using a grid hierarchy and would like to set the title of the grid hierarchy column to say "Details" rather than it just be an empty column title. This is the column that contains the expand/collapse icons.
answered on 30 May 2024, 09:13 AM
| edited on 30 May 2024, 09:14 AM
Here’s how you can achieve that:
Define the DetailTemplate: In your Kendo UI Grid configuration, define the DetailTemplate for the hierarchical data. This template will be used to display the child grid when expanding a row. Customize the Hierarchy Column Title: By default, the hierarchy column is automatically generated and doesn’t have a specific title. To set a custom title for this column, you can do the following:
$("#grid").kendoGrid({ dataSource: { // Your data source configuration here }, columns: [ // Other columns... { field: "yourHierarchyField", title: "Custom Hierarchy Title", // Set your desired title here template: kendo.template($("#detail-template").html()) } ], detailTemplate: kendo.template($("#child-grid-template").html()) });
In the above code snippet: Replace "yourHierarchyField" with the actual field name that represents the hierarchy in your data. Set "Custom Hierarchy Title" to the title you want for the hierarchy column. Create the Detail Template: Define the detailTemplate using the kendo.template function. This template will be used to render the child grid when a row is expanded. Style and Customize the Child Grid: Inside your detailTemplate, you can customize the child grid as needed. You can add additional columns, apply styling, and configure other settings specific to the child grid.