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.
| Key | What it does |
|---|---|
fullWidthRow.when(row, key) | Rows for which it returns true are drawn as one cell |
fullWidthRow.renderer | Factory that draws the cell: mount(el, ctx), optional update(ctx) and destroy() |
fullWidthRow.height | Height of that row in px; only applied when rowHeight is a function, ignored otherwise |
fullWidthRow.text | Row text, used as the accessible name (aria-label) of the cell |
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 functionThe 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.
| Key | What it does |
|---|---|
grouping.editable: true | Every group row can be edited |
grouping.editable: (groupKey, level) => boolean | Decide per group key and level |
- Enter commits; Esc, or the same value, writes nothing.
- The write is one
updateCellscall, 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,validationFailedfires 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.beforeEditandeditApply: 'app'do not apply to this path.