Skip to content

Full-width rows and group edit ​

Full-width rows ​

Sometimes content such as a notice or a divider has to fill the whole line instead of being split into cells. fullWidthRow draws each data row that matches a condition as one cell covering the whole line. Without it nothing changes.

KeyWhat it does
fullWidthRow.when(row, key)Rows for which it returns true are drawn as one cell
fullWidthRow.rendererFactory that draws the cell: mount(el, ctx), optional update(ctx) and destroy()
fullWidthRow.heightHeight of that row in px; only applied when rowHeight is a function, ignored otherwise
fullWidthRow.textRow text, used as the accessible name (aria-label) of the cell
ts
fullWidthRow: {
  when: (row) => row.kind === 'note',
  renderer: () => ({
    mount(el, { row }) {
      el.textContent = row.text; // text through textContent
    },
  }),
  height: 48,
},
rowHeight: () => 32, // height needs rowHeight to be a function

The row stays a data row. Sorting, filtering, selection, change tracking and getRows work as for any row, and clicking the row selects it. Such a row cannot be edited: startEdit throws invalid-option. When the same row is drawn again update is called, and destroy runs when it turns into a normal row or the grid is destroyed. If when throws, that line is drawn as a normal row and the error is logged once. These rows take no part in horizontal virtualization or cell merging.

Two limits: left and right keys still pass through the hidden cells (the row is not one focus stop), and export and copy write the column values as usual.

Editing a group value ​

With grouping.editable on, double-click the value cell of a group row to rename the group. When you finish, the new value is written into the group field of every child row at once.

KeyWhat it does
grouping.editable: trueEvery group row can be edited
grouping.editable: (groupKey, level) => booleanDecide per group key and level
  • Enter commits; Esc, or the same value, writes nothing.
  • The write is one updateCells call, so it is one undo step and tracked per row.
  • Before writing, the rule (validation) of the column is checked for every child row. If any fails nothing is written, validationFailed fires and the editor shows the reason.
  • After writing the grid regroups. A new value equal to another group merges the two groups.
  • The editor is a text field; number columns are converted to numbers. hooks.beforeEdit and editApply: 'app' do not apply to this path.