I want to show an icon in all columns' headers when grid is in default state (No sorting applied) to let user know the columns are sortable and also want to customize the up and down arrow icons when sorting is applied.
2 Answers, 1 is accepted
0
Accepted
Hetali
Telerik team
answered on 19 Feb 2021, 09:01 PM
Hello Maitri,
Grid header default state icon
In order to show an icon in the Kendo UI Grid Column Header when there is no sorting applied, use the kendoGridHeaderTemplate as seen below:
In this StackBlitz example, I have replaced the built-in sort icons and added an unsort icon in the Kendo UI Grid Header. Please make sure to set the encapsulation to ViewEncapsulation.None to set the built-in icons' style locally.
I hope this helps. Please let me know if I can further assist you.
Regards,
Hetali
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Is this still the proper of adding the unsort icon? I find it a bit hacky, I wish there was a built in support for it.
Georgi
Telerik team
commented on 28 Mar 2023, 03:24 PM
Hi Sami,
As of now, the Grid component does not provide such a built-in property that would allow the developer to add the unsort icon. For this reason, utilizing the HeaderTemplateDirective with the suggested code snippet remains a valid approach for achieving the desired functionality.
When it comes to modifying the default icons indicating the direction in which the Grid has been sorted, an alternative approach would be to use our built-in ICON_SETTINGS token. For further reference for this approach, I would suggest checking out our Icon Settings article:
How can this be accomplished for UI for ASP.NET Core? The CSS to hide the built in icons works fine but I'm not sure how to set the custom icon in the grid header template.