Column Reordering

i see there are a few methods to reorder columns. 

i am trying to figure out how to simply reorder all columns in a specific order

something like 

<SfGrid @ref="Grid" DataSource="@Orders" Height="315" AllowReordering="true">
    <GridColumns>
        <GridColumn Field=@nameof(OrderDetails.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="100"></GridColumn>
        <GridColumn Field=@nameof(OrderDetails.CustomerID) HeaderText="Customer ID" Width="100"></GridColumn>
        <GridColumn Field=@nameof(OrderDetails.ShipCity) HeaderText="Ship City" Width="100"></GridColumn>
        <GridColumn Field=@nameof(OrderDetails.ShipRegion) HeaderText="Ship Region" Width="100"></GridColumn>
        <GridColumn Field=@nameof(OrderDetails.ShipName) HeaderText="Ship Name" Width="120"></GridColumn>
    </GridColumns>
</SfGrid>
List<string> ColumnNames = (new List<string> { "ShipName", "CusrtomerId", "ShipCity", "OrderID", "ShipRegion" });
Grid.ReorderColumns(ColumnNames)

the one i see (ReorderColumnsAsync) requires a column to insert before


1 Reply

PS Prathap Senthil Syncfusion Team April 6, 2026 12:43 PM UTC

Hi Michael Salzlechner,

Based on the details you shared, we understand that you would like to reorder all columns into a specific order. Currently, we do not provide a direct method to reorder all columns at once in the required manner. The ReorderColumnsAsync(List<string>, string) method, please note that it only changes the Grid column positions based on the provided column field names, and it does not support reordering all columns in a single operation.

To achieve your requirement, we suggest a workaround approach by using the Grid instance’s Columns collection to arrange the columns in the desired order. Kindly refer to the below code snippet and sample for your reference.


Code Snippet:

 

    private async Task ReorderColumn()

    {

        var desired = new List<string> { "ShipName", "CustomerID", "ShipCity", "OrderID", "ShipRegion" };

 

        List<GridColumn> columns = Grid.GetColumnsAsync().Result.OrderBy(c => desired.IndexOf(c.Field)).ToList();

#pragma warning disable BL0005

        Grid.Columns = columns;

#pragma warning disable BL0005

       // Grid.Refresh();

       await Grid.RefreshColumnsAsync();

    }

 


API Reference:
Class SfGrid<TValue> - Blazor API Reference | Syncfusion

Sample: https://blazorplayground.syncfusion.com/embed/VNVxDTNnqLzSeGfU?appbar=true&editor=true&result=true&errorlist=true&theme=fluent2


Regards,
Prathap Senthil


Loader.
Up arrow icon