Frozen rows and columns

21 Dec 20226 minutes to read

Frozen rows and columns

Frozen rows and columns provides an option to make rows and columns always visible in the top and left side of the tree grid while scrolling.

In this demo, the frozenColumns is set as ‘2’ and the frozenRows is set as ‘3’. Hence, the left two columns and top three rows are frozen.

<ejs-treegrid id="TreeGrid" dataSource="ViewBag.datasource" height="410" width="auto" childMapping="Children" treeColumnIndex="1" frozenRows= "3" allowSelection="false" frozenColumns="2">
            <e-treegrid-columns>
                <e-treegrid-column field='TaskId' headerText='Task ID' width='100' textAlign='Right'></e-treegrid-column>
                <e-treegrid-column field='TaskName' headerText='Task Name' width='230'></e-treegrid-column>
                <e-treegrid-column field='StartDate' headerText='Start Date' width='150' format="yMd" textAlign='Right'></e-treegrid-column>
                <e-treegrid-column field='EndDate' headerText='End Date' width='150' format="yMd" textAlign='Right'></e-treegrid-column>
                <e-treegrid-column field='Duration' headerText='Duration' width='120' textAlign='Right'></e-treegrid-column>
                <e-treegrid-column field='Progress' headerText='Progress' width='120' textAlign='Right'></e-treegrid-column>
                <e-treegrid-column field='Priority' headerText='Priority' width='120'></e-treegrid-column>
                <e-treegrid-column field="Approved" headerText="Approved" textAlign="Left" width="110" type="boolean"></e-treegrid-column>
            </e-treegrid-columns>
</ejs-treegrid>
public IActionResult FrozenColumn()
        {
            ViewBag.datasource = TreeData.GetDefaultData();
            return View();
        }

Freeze particular columns

To freeze particular column in the tree grid, the isFrozen property of e-treegrid-column tag helper can be used.

In this demo, the columns with field name TaskName and StartDate is frozen using the isFrozen property of e-treegrid-column.

<ejs-treegrid id="TreeGrid" dataSource="ViewBag.datasource" height="410" width="auto" childMapping="Children" allowSelection="false">
    <e-treegrid-columns>
        <e-treegrid-column field='TaskId' headerText='Task ID' width='100' textAlign='Right'></e-treegrid-column>
        <e-treegrid-column field='TaskName' headerText='Task Name' width='230' isFrozen="true"></e-treegrid-column>
        <e-treegrid-column field='StartDate' headerText='Start Date' width='150' isFrozen="true" format="yMd" textAlign='Right'></e-treegrid-column>
        <e-treegrid-column field='EndDate' headerText='End Date' width='150' format="yMd" textAlign='Right'></e-treegrid-column>
        <e-treegrid-column field='Duration' headerText='Duration' width='120' textAlign='Right'></e-treegrid-column>
        <e-treegrid-column field='Progress' headerText='Progress' width='120' textAlign='Right'></e-treegrid-column>
        <e-treegrid-column field='Priority' headerText='Priority' width='120'></e-treegrid-column>
        <e-treegrid-column field="Approved" headerText="Approved" textAlign="Left" width="110" type="boolean"></e-treegrid-column>
    </e-treegrid-columns>
</ejs-treegrid>
public IActionResult FrozenColumn()
        {
            ViewBag.datasource = TreeData.GetDefaultData();
            return View();
        }

Freeze direction

You can freeze the tree grid columns on the left or right side by using the column.freeze property and the remaining columns will be movable. The tree grid will automatically move the columns to the left or right position based on the column.freeze value.

Types of the column.freeze directions:

  • Left: Allows you to freeze the columns at the left.
  • Right: Allows you to freeze the columns at the right.

In this demo, the Task Name column is frozen at the left and the Priority column is frozen at the right side of the content table.

<ejs-treegrid id="TreeGrid" dataSource="ViewBag.datasource" height="410" treeColumnIndex="1" childMapping="Children" allowSelection="false">
    <e-treegrid-columns>
        <e-treegrid-column field='TaskId' headerText='Task ID' width='100' textAlign='Right'></e-treegrid-column>
        <e-treegrid-column field='TaskName' headerText='Task Name' width='230' freeze="Left"></e-treegrid-column>
        <e-treegrid-column field='StartDate' headerText='Start Date' width='150' format="yMd" textAlign='Right'></e-treegrid-column>
        <e-treegrid-column field='EndDate' headerText='End Date' width='150' format="yMd" textAlign='Right'></e-treegrid-column>
        <e-treegrid-column field='Duration' headerText='Duration' width='120' textAlign='Right'></e-treegrid-column>
        <e-treegrid-column field='Progress' headerText='Progress' width='120' textAlign='Right'></e-treegrid-column>
        <e-treegrid-column field='Priority' headerText='Priority' width='120' freeze="Right"></e-treegrid-column>
        <e-treegrid-column field="Approved" headerText="Approved" textAlign="Left" width="110" type="boolean"></e-treegrid-column>
    </e-treegrid-columns>
</ejs-treegrid>
public IActionResult FrozenColumn()
        {
            ViewBag.datasource = TreeData.GetDefaultData();
            return View();
        }

NOTE

  • Freeze Direction is not compatible with the isFrozen and frozenColumns properties.

Limitations of frozen tree grid

The following features are not supported in frozen rows and columns:

  • Row Template
  • Detail Template
  • Cell Editing

Freeze Direction feature has the below limitations, along with the above mentioned limitations.

  • Infinite scroll cache mode
  • Freeze direction in the stacked header is not compatible with column reordering.

NOTE

You can refer to our ASP.NET Core Tree Grid feature tour page for its groundbreaking feature representations. You can also explore our ASP.NET Core tree grid example ASP.NET Core Tree Grid example to knows how to present and manipulate data.