This is a migrated thread and some comments may be shown as answers.

Column chooser custom icon

1 Answer 1187 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Cooler
Top achievements
Rank 1
Veteran
Cooler asked on 10 Nov 2020, 06:59 AM
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

Sort by
-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:

https://www.telerik.com/kendo-angular-ui/components/styling/icons/#basic-usage

Regards,
Martin
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/.

Dominik
Top achievements
Rank 1
Veteran
Iron
commented on 10 Jul 2023, 02:37 PM

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()
export class MyIconService extends IconSettingsService {

  private svgDictionary: { [key: string]: SVGIcon } = {
    'more-vertical': paperclipIcon // changes the Column Menu icon of the Grid
  };

  public getSvgIcon(svgIconName: string): SVGIcon {
    return this.svgDictionary[svgIconName] || super.getSvgIcon(svgIconName);
  }
}

For more details please check the following article:

https://www.telerik.com/kendo-angular-ui/components/icons/icon-settings/#toc-changing-the-built-in-icons

Here is an example where the Column Menu icon of the Grid is replaced:

https://stackblitz.com/edit/angular-fcjtyu

I hope this helps.

Dominik
Top achievements
Rank 1
Veteran
Iron
commented on 12 Jul 2023, 11:43 AM

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. 

 

Tags
Grid
Asked by
Cooler
Top achievements
Rank 1
Veteran
Answers by
Martin Bechev
Telerik team
Share this question
or