Search results

State Persistence

31 Mar 2023 / 1 minute to read

Syncfusion JavaScript (ES5) library has support for persisting its control state across page refreshes or navigation. To enable this feature, set enablePersistence property as true to the required control. This will store the control’s state in browser’s localStorage object on page unload event. For example, enablePersistence property set to the grid control in the following code.

Copied to clipboard
ej.grids.Grid.Inject(ej.grids.Page);

var grid = new ej.grids.Grid({
    dataSource: data,
    enablePersistence: true,
    columns: [
        { field: 'OrderID', headerText: 'Order ID', textAlign: 'right', width: 120 },
        { field: 'CustomerID', headerText: 'Customer ID', width: 150 },
        { field: 'ShipCity', headerText: 'Ship City', width: 150 },
        { field: 'ShipName', headerText: 'Ship Name', width: 150 }
    ],
    height: 268
});
grid.appendTo('#Grid');