Skip to content

Frozen Rows


It is quit easy for developers to make some rows frozen/locked within jqGrid. The locked rows do not scroll out of view when users moving vertically across the grid.

As of version 5.7 jqGrid support frozen rows. In the time of writing this documentation the support of frozen rows is very limited. Please refer to limitations to see

Setup

To setup the frozen rows property it is needed to call the method setFrozenRows after the creation of the grid.

```js
...
jQuery("#grid").jqGrid({ ... });
...
jQuery("#grid").jqGrid('setFrozenRows', options);
...

where the options is a object with the following default properties.

```js
options = {
    first : 0,
    last : 0,
    rowids :[],
    saveFirstLastId : false,
    classes : ""
}
  • first - integer- parameter which specify how many index row(s) from the top current view should be locked. 1 means first row, 2 means first and second rows and etc.
  • last -integer- parameter which specify how many index row(s) from the bottom current view should be locked. 1 means last row, 2 means last and penultimate rows and etc.
  • rowids - array- if set this array should contain the ids of the rows which will be locked.
  • saveFirstLastId - boolean - this parameter work only is first or last parameters are set. In case of true the ids of the locked rows will be saved when for first time the method is executed and will stay on top regardless of sorting paging an etc.
  • classes - string - this string will be added as class of the locked row(s)

Note

If for some reason the first and/or last and/or rowids parameters are set, the higher priority has the rowids parameter, then first and the last one

Destroy

To destroy the frozen rows use destroyFrozenRows method.

...
jQuery("#grid").jqGrid('destroyFrozenRows', deep);
...

where deep is a logical parameter which if is set to true, removes all data related to frozen rows. By default this parameter is false.

Note

When the frozen rows are initialized, we internally create a object grid parameter frozenRowsPrm which is needed for recreation of the rows when a paging and/or sorting is applied.

Limitations

The frozen rows is a new feature and hence it has some limitations which in the future will be removed. Below are the limitations for the frozen rows. The frozen rows will not be initialized when:

  • when sibGrid is enabled
  • when treeGrid is enabled
  • when cellEdit is enabled
  • when data grouping is enabled
  • when virtual scrolling is enabled (scroll: 1)
  • when frozen columns are enabled

If one of these modules are activated and you for some reason call frozenRows method you should expect unexpected behaviors.