Hello. Is it possible to use custom svg icon instead default icon <kendo-grid-column-chooser>? And also can i add some text label near icon?
1 Answer, 1 is accepted
-1
Martin Bechev
Telerik team
answered on 11 Nov 2020, 11:53 AM
Hello,
Thank you for the screenshot.
In general, the default kendo icons can be replaced, using the content CSS property. For more details check the following article from our documentation:
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/.
but what if we want to use svg icon from kendo svg icons?
there is no property svgIcon like in others like buttons.
there is even no template to change visuals of column chooser
Martin Bechev
Telerik team
commented on 12 Jul 2023, 10:28 AM
Hi Dominik,
In order to change SVG icon on which the developer doesn't have direct access, create a custom service that extends the IconSettingsService and override the getSvgIcon function.
@Injectable()
exportclassMyIconServiceextendsIconSettingsService{
private svgDictionary: { [key: string]: SVGIcon } = {
'more-vertical': paperclipIcon // changes the Column Menu icon of the Grid
};
public getSvgIcon(svgIconName: string): SVGIcon {
returnthis.svgDictionary[svgIconName] || super.getSvgIcon(svgIconName);
}
}
For more details please check the following article:
yes but this is globally overriding this icon key isn't it?
Martin Bechev
Telerik team
commented on 14 Jul 2023, 07:33 AM
Hi Dominik,
Yes, this will overwrite all 'more-vertical' icons in the application.
The alternative approach is to use custom JavaScript code and replace the SVG icon in DOM with the desired SVG icon from the list. However this would be hard to maintain as the implementation would rely on query selectors and generic HTML methods.