LyteNyte Grid logo for light mode. Links back to the documentation home page.
Columns

Marker Column

The marker column is an auxiliary column created and managed by LyteNyte Grid. It is always pinned to the start of the viewport.

Use the marker column for information that does not come from the row data or for interactive actions that do not fit cleanly into other columns. Common use cases include:

  • Displaying the current row index.
  • Rendering a checkbox for row selection.

Enabling Marker Column

Enable the marker column using the columnMarkerEnabled property on the grid state. When enabled, provide a column specification using the columnMarker property.

The demo below shows the marker column displaying row indices. The displayed index starts at 1, while actual row indices in LyteNyte Grid start at 0.

Row Index Marker Column

Below is the code that enables the marker column and defines its renderer:

const grid = Grid.useLyteNyte({
// Other grid properties...
columnMarkerEnabled: true,
columnMarker: {
cellRenderer: (p) => {
return <div>{p.rowIndex + 1}</div>;
},
},
});

The marker column differs from standard columns and has important restrictions:

  • It is always pinned to the start of the viewport.
  • It cannot be moved or reordered.
  • It is not part of the columns state but does affect column display order. When enabled, the marker column always appears first, and display index 0 refers to the marker column.

Selection Marker Column

A common use case for the marker column is row selection. The marker column can render a checkbox for each row. Because this is so common, LyteNyte Grid provides the api.rowHandleSelect method to simplify selection logic, including shift-select behavior.

Marker Column Selection

The demo uses api.rowHandleSelect to manage checkbox interactions:

<GridCheckbox
onClick={(ev) => {
ev.stopPropagation();
grid.api.rowHandleSelect({ shiftKey: ev.shiftKey, target: ev.target });
}}
onKeyDown={(ev) => {
if (ev.key === "Enter" || ev.key === " ")
grid.api.rowHandleSelect({ shiftKey: ev.shiftKey, target: ev.target });
}}
/>

Next Steps

  • Column Resizing: Change column widths programmatically or through user interaction.
  • Column Moving: Reorder columns programmatically or through drag-and-drop.
  • Column Groups: Create a column header hierarchy and associate columns with column groups.
  • Column Field: Control how a column retrieves each cell's value.