How to manipulate the text of the k-group-indicator button

0 Answers 22 Views
Grid
James
Top achievements
Rank 1
James asked on 26 Feb 2025, 08:08 PM

In my formatting of the grid I set the grid column titles. However when the user groups by the columns the k-group-indicator button uses the same "Title". Is there a way to have the k-group-indicator display a different text? My issue is that it doesn't format as HTML the same as the grid so it displays the html markup "<br/></th>" which is not what I want.

 

 {
                    field: "ClientName", title: "[[[Client<br/>Name]]]",
                    template: "#= data.ClientName #",
                    width: 100,
                    groupHeaderTemplate: "[[[Client Name]]] ${data.value}",
                    hideOnGroup: true
                },
                {
                    field: "Acct", title: "[[[Account<br/>Number]]]",
                    template: "#= data.Acct #",
                    width: 100,
                    groupHeaderTemplate: "[[[Account Number]]]  ${data.value}",
                    hideOnGroup: true
                },
 {
                    field: "ClientName", title: "[[[Client<br/>Name]]]",
                    template: "#= data.ClientName #",
                    width: 100,
                    groupHeaderTemplate: "[[[Client Name]]] ${data.value}",
                    hideOnGroup: true
                },
                {
                    field: "Acct", title: "[[[Account<br/>Number]]]",
                    template: "#= data.Acct #",
                    width: 100,
                    groupHeaderTemplate: "[[[Account Number]]]  ${data.value}",
                    hideOnGroup: true
                },

Nikolay
Telerik team
commented on 03 Mar 2025, 01:57 PM

Hi James,

Thank you for sharing this use case with us. At the time being it is not possible to render HTML in the groupHeaderTemplate. I will investigate if a workaround is possible and will get back to you.

Regards,

Nikolay

James
Top achievements
Rank 1
commented on 17 Mar 2025, 08:20 PM

I think my issue may be solved by removing the <br/> HTML markup from the title and applying the style  headerAttributes: { style: "white-space: pre-wrap;" },

This formats the title over two lines correctly and doesn't have a negative affect on the Grouping header.

Nikolay
Telerik team
commented on 20 Mar 2025, 12:23 PM

Hi James,

A possible workaround is to append the HTML with jQuery in the dataBound event handler:

              dataBound: function() {
                setTimeout(function() {
                  	let label = $(".k-grouping-header").find(".k-chip-label").text();
                	$(".k-grouping-header").find(".k-chip-label").text("").append("<div>" + label + "</div>")
                });
              }

Dojo demo: https://dojo.telerik.com/VYWqlEBE

Regards,

Nikolay

No answers yet. Maybe you can help?

Tags
Grid
Asked by
James
Top achievements
Rank 1
Share this question
or