Notices and cell toasts
Sometimes you want to tell the user something short without leaving the grid, such as "saved" or "this cell cannot be changed". Every method below creates one element inside the grid DOM and replaces the one that is already there. None of them takes focus.
| Method | What it does |
|---|---|
showNotice(text, { tone?, ttl? }) | One notice strip at the top of the grid; a new call replaces it |
clearNotice() | Remove the notice strip |
showCellToast(rowKey, columnId, text, { tone?, ttl? }) | One short toast below that cell |
clearCellToast() | Remove the toast |
startEdit(rowKey, columnId, { open? }) | With open: true, also open the editor's list or calendar |
setEditorValue(value) | Write a value into the open editor, without committing |
tone is 'info' (default), 'success', 'warning' or 'danger'. danger uses role="alert", which screen readers announce at once; the others use role="status". ttl is in milliseconds: the strip defaults to 0 (until cleared) and the toast to 3200. Text goes in through textContent only, so HTML is shown as plain text.
api.showNotice('Saved 3 rows', { tone: 'success', ttl: 4000 });
api.showCellToast(rowKey, 'salary', 'Must be greater than 0', { tone: 'danger' });The toast sits below the cell only when that cell is drawn; otherwise it sits at the top of the grid. It never scrolls, so call scrollToRow first if the cell must be visible. A bad value (unknown column, ttl out of range, wrong tone) throws invalid-option before anything changes. Nothing moves, so there is no prefers-reduced-motion case to handle.
Start an edit and write a value
startEdit(rowKey, columnId, { open: true }) opens the popup of date and time pickers and select lists as soon as the edit starts. Editors without a popup, such as text, ignore open. setEditorValue(value) writes the value into the open editor's input and lets the editor read it through its own path (input and change events). It does not commit; use stopEdit() or Enter. With no open editor it throws invalid-option. A custom editor with setValue(value) or open() methods is called first.
The cell of an error
The error event carries cell: { rowKey, columnId } only where the cell is known: exceptions from cell editors and cell renderers. Errors without a cell (option validation and so on) have no cell.