Search results

State Persistence

Syncfusion Blazor platform supports for persisting a component’s state across page refreshes or navigation. To enable this feature, set the EnablePersistence property to true to the required component. This will store the component’s state in browser’s localStorage object on page unload event. For example, persistence has been enabled to grid component in the following code.

<EjsGrid DataSource="@Orders" ID="grid" EnablePersistence="true" AllowPaging="true" AllowSorting="true" AllowFiltering="true" AllowGrouping="true">
    <GridPageSettings PageSize="5"></GridPageSettings>
    <GridColumns>
        <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>
        <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn>
        <GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="yMd" Type="date" TextAlign="TextAlign.Right" Width="130"></GridColumn>
        <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>
    </GridColumns>
</EjsGrid>

Note: The state of the component is retained during navigation or refreshment based on ID. Make sure to set ID for the component to store the component’s state in browser.