Row interface

Row interface contains two necessary properties: rowId and cells. It contains essential information about the grid row. cells field allows you to declare an array of objects that extends Cell [] base interface.

Usage

const rows: Row[] = [
  {
    rowId: 0,
    cells: [
      { type: "text", text: 'John' },
      { type: "text", text: "Doe" },
    ]
  }
]

If you want to use your custom cell templates in code, the correct way of doing so is: Row<DefaultCellTypes | MyCustomCell>.

interface FlagCell extends Cell {
  type: 'flag';
  text: string;
}

export const rows: Row<DefaultCellTypes | FlagCell>[] = [ // union of all  available cells
  {
    rowId: 0,
    cells: [
      { type: "text", text: 'John' },
      { type: "text", text: "Doe" },
      // `flag type is now allowed
      { type: 'flag', text: 'ger' },    ]
  }
]

Definition

export interface Row<TCell extends Cell = DefaultCellTypes> {
  readonly rowId: Id;
  readonly cells: TCell[];
  readonly height?: number;
  readonly reorderable?: boolean;
};

Properties

Property nameTypeProperty description
rowId Id Unique Id in all rows array
cells Cell [] TCell extends Cell []Array of Cell objects.
height?numberHeight of each grid row (in default set to 25px)
reorderable?booleanProperty that allows row to change is position in grid, default: false (row reorder implementation is on the developer’s side)