#102502
TurricanDE
Participant

I could’t find a method “SortBy” (we are in Blazor)?

I could use an event callback “Sort” e.g.

private async Task Sort(Event ev)
{
GridSortEventDetail sortEventDetail = ev[“Detail”];

var sortIndex = sortEventDetail.Columns[0][“sortIndex”];

}

But the sortIndex is always “0”, but I know it must be somewhere, how does the grid know the sort index (sort indexes are shown in the columns 😉

The problem is when the user does a multiple sort and I want to save these settings there is no way to set the sort indexes correctly again.

For example we have three columns

ID [SortOrder DESC, SortIndex = 2] Name [SortOrder ASC, SortIndex = 1] Address [SortOrder ASC, SortIndex =3]

I want to set the colums array programmatically when the user chooses a specific setting. I can reproduce all sort orders for the columns but not the sort indexes

GridColumn newColumn = new GridColumn()
{
Label = …..,
SortOrder = GridColumnSortOrder.Asc,
SortIndex = …. <= I need this

}….