Skip to main content

DxDataGrid<T>.LayoutChanged Event

Fires when a user changes a grid’s layout.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v22.1.dll

Declaration

[Parameter]
public Action<IDataGridLayout> LayoutChanged { get; set; }

Parameters

Type Description
IDataGridLayout

An object that implements the IDataGridLayout interface and stores information about a grid’s layout.

Remarks

Important

The Data Grid was moved to maintenance support mode. No new features/capabilities will be added to this component. We recommend that you migrate to the Grid component.

Handle the LayoutChanged event to save the grid’s layout (SaveLayout) when the user changes it. The layout information includes the current page, column sort order/direction, column position, filter values, and grouped columns.

Note

The saved layout does not include information about expanded rows in groups.

The code below demonstrates how to save and restore the grid’s layout.

<DxDataGrid ...
    LayoutRestoring="@OnLayoutRestoring"
    LayoutChanged="@OnLayoutChanged">
</DxDataGrid>

@code {
     void OnLayoutChanged(IDataGridLayout dataGridLayout) {
        var layout = dataGridLayout.SaveLayout();
        // persist the layout in your storage
    }
    void OnLayoutRestoring(IDataGridLayout dataGridLayout) {
        var layout = … // restore layout from your storage
        dataGridLayout.LoadLayout(layout);
    }
}

View Example: Blazor Data Grid - How to save/load a grid's layout information

See Also