UI for ASP.NET MVC 2023.2.606 - Kendo Grid Toolbar Item .IconClass Setting Not Respected

1 Answer 202 Views
Grid Toolbar
Michael
Top achievements
Rank 2
Iron
Iron
Iron
Michael asked on 21 Jun 2023, 03:18 PM
Using the UI for ASP.NET MVC 2023.2.606 build and trying to set custom icons for the native grid excel export toolbar item (ref snippet below) - unlike the same build # for MVC CORE the .IconClass "override" setting is not respected and defaults to rendering the pure kendo .svg icon for excel.  Compare the 2 image captures of the rendered html/classes for the same defined toolbar between the ASP.NET MVC and MVC CORE builds


                       .ToolBar(t => {
                            if (PermissionHelper.HasPermissionAny(Roles.RoleAdmin))
                            {
                                t.Create().Text("Add User Role");
                            }
                            t.Excel().Text("Export to Excel").IconClass("fa-solid fa-file-excel");
                        })

1 Answer, 1 is accepted

Sort by
0
Patrick | Technical Support Engineer, Senior
Telerik team
answered on 26 Jun 2023, 07:27 PM

Hello Michael,

As of R2 2023, the default icon type for Telerik and Kendo UI themes has changed from font to svg.  That being said, if you would like to continue to utilize Font icons instead of the new SVG icons, you can use the setDefaults method to change the iconType back to font:

<script>
    kendo.setDefaults('iconType', 'font');
</script>

Alternatively, you could configure it on the server:

    KendoMvc.Setup(x =>
    {
        x.IconType = IconType.Font;
    });

Regards,
Patrick | Technical Support Engineer, Senior
Progress Telerik

As of R2 2023, the default icon type will be SVG instead of Font. See this blogpost for more information.

Michael
Top achievements
Rank 2
Iron
Iron
Iron
commented on 26 Jun 2023, 08:47 PM

Patrick,

Thanks for the details and I was aware of that but it seems odd to me that the MVC CORE build with same version # respects the IconClass settings but the ASP.NET MVC does not - is there some sort of under the covers variance between the 2 such that one isn't fully caught up to the switch to SVG icons as the default yet (i.e. MVC CORE)?  I'm certain I have not set my MVC CORE to revert back to font icons so that is what struck me as odd that it would still respect the .IconClass setting.

Regards,

Michael Jensen

Patrick | Technical Support Engineer, Senior
Telerik team
commented on 29 Jun 2023, 05:15 PM

Based on this information, I can confirm the behavior.  To help further investigate, I have reached out to our development team to analyze the issue.  Once I receive more details, I will update this thread.

In the meantime, please feel free to use this workaround:

.ToolBar(t => t.Custom().Text("Export to Excel").IconClass("fas fa-solid fa-file-excel").HtmlAttributes(new { @class = "k-grid-excel" }))

 

Patrick | Technical Support Engineer, Senior
Telerik team
commented on 30 Jun 2023, 06:30 PM

I have heard from our development team, and the behavior has been confirmed as a bug.  The following bug reports have been created:

Please feel free to follow/subscribe to each, and provide comments/details within each for the developer community. Thank you for bringing this to our attention, and I have updated your Telerik Points as a sign of gratitude.

Tags
Grid Toolbar
Asked by
Michael
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Patrick | Technical Support Engineer, Senior
Telerik team
Share this question
or