gustavnavar / Grid.Blazor

Grid component with CRUD for Blazor (client-side and server-side) and ASP.NET Core MVC
GNU Lesser General Public License v2.1
697 stars 135 forks source link

Make three state sorting optional #365

Closed tony-asu closed 1 year ago

tony-asu commented 1 year ago

Is your feature request related to a problem? Please describe. I need to implement two state sorting on an existing set of grids

Describe the solution you'd like To pass an optional variable into the sort function to allow toggling between two and three state sorting.

Describe alternatives you've considered Currently, I'm setting the column's InitialDirection in the OnSortChangedEvent, as this results in 2 state sorting, and setting the InitialDirection any other way caused issues with how the grid was initially sorted. This seems less than ideal, but it works

    private async Task SortChanged(object sender, SortEventArgs e)
    {
        _grid.Columns.GetByName(e.ColumnName).InitialDirection = GridSortDirection.Ascending;
        await Task.CompletedTask;
    }
gustavnavar commented 1 year ago

Package version 3.5.0 includes this feature.

You can see the documentation here