Immutable Mode

21 Dec 20221 minute to read

The immutable mode optimizes the Grid re-rendering performance by using the object reference and deep compare concept. When performing the Grid actions, it will only re-render the modified or newly added rows and prevent the re-rendering of the unchanged rows.

To enable this feature, you have to set the enableImmutableMode property as true.

NOTE

  • This feature uses the primary key value for data comparison. So, you need to provide the isPrimaryKey column.
@Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.DataSource).EnableImmutableMode(true).AllowPaging(true).Columns(col =>
{
    col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).Width("120").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
    col.Field("ProductName").HeaderText("Product Name").Width("160").Add();
    col.Field("ProductID").HeaderText("Product ID").Width("120").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
    col.Field("CustomerID").HeaderText("Customer ID").Width("120").Add();
    col.Field("CustomerName").HeaderText("Customer Name").Width("160").Add();
}).Render()
public IActionResult Index()
{
    ViewBag.DataSource = OrderDetails.GetAllRecords();
    return View();
}

Limitations

The following features are not supported in the immutable mode:

  • Frozen rows and columns
  • Row Template
  • Detail Template
  • Hierarchy Grid
  • Column reorder
  • Virtual scroll
  • Infinite scroll
  • Grouping