Completed
Last Updated: 12 Feb 2025 16:02 by ADMIN
Release 8.0.0
Joe
Created on: 29 Jan 2025 20:08
Category: Grid
Type: Bug Report
0
GridColumnMenu icon highlighted on sorted column even with Sortable set to false

I've customized the GridColumnMenu to only show the Column Chooser and assign Locked Columns (disabled all others, including Sortable):

<GridColumnMenuSettings
	FilterMode="@ColumnMenuFilterMode.None"
	Lockable="true"
	ShowColumnChooser="true"
	Groupable="false"
	Sortable="false"
	Reorderable="false">
</GridColumnMenuSettings>

I'm handling the sorting by clicking directly on the column header.   In that configuration, the menu icon is highlighted for the actively sorted column:

This is misleading because the user cannot affect the sorting via the column menu.  If Sortable = "false", I'd expect no indicator difference in the column headers.

2 comments
Joe
Posted on: 05 Feb 2025 16:30

Thanks for the update, Dimo, and for trying to squeeze it into the upcoming release.  I also appreciate the CSS workaround.

Joe

ADMIN
Dimo
Posted on: 05 Feb 2025 12:18

Thanks, Joe, I will try to squeeze a fix for the coming release next week.

An immediate workaround for your scenario is to restore the non-highlighted icon with CSS:

<TelerikGrid Data="@GridData"
             Sortable="true"
             ShowColumnMenu="true"
             FilterMode="@GridFilterMode.FilterRow"
             Class="no-column-menu-highlight">
    <GridSettings>
        <GridColumnMenuSettings Sortable="false" FilterMode="@ColumnMenuFilterMode.None" />
    </GridSettings>
    <GridColumns>
        <GridColumn Field="@nameof(SampleModel.Name)" />
        <GridColumn Field="@nameof(SampleModel.Quantity)" />
        <GridColumn Field="@nameof(SampleModel.Active)" />
    </GridColumns>
</TelerikGrid>

<style>
    .no-column-menu-highlight .k-grid-column-menu.k-active {
        background-color: transparent;
        color: inherit;
    }
</style>

@code {
    private List<SampleModel> GridData { get; set; } = new();

    protected override void OnInitialized()
    {
        for (int i = 1; i <= 7; i++)
        {
            GridData.Add(new SampleModel()
            {
                Id = i,
                Name = $"Name {i}",
                Quantity = Random.Shared.Next(0, 1000),
                Active = i % 2 == 0
            });
        }
    }

    public class SampleModel
    {
        public int Id { get; set; }
        public string Name { get; set; } = string.Empty;
        public int Quantity { get; set; }
        public bool Active { get; set; }
    }
}

 

Regards,
Dimo
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.