Grid column sizing, aligned grids, external filter, notes and hooks
Flex widths. The grid calls core applyFlexWidths with the clientWidth of the scroller.
Context
The parity matrix had flex widths, auto-size, auto-generated columns, aligned grids, the
external filter and notes as "planned" or "partial" in the Grid. Other tracks asked for hooks:
the range on the context menu API, a header label slot, a row header role for row numbers, a
row editor that a nested grid does not confuse, a long press that opens one menu, and the format
of column types. Research S13 asked for a new name of the row data-slot attribute. The
maintainer was not available, so this ADR records the decisions. Contract section 11 has the DOM
and the API.
Decision drivers
Not recorded in the original ADR.
Options considered
Not recorded in the original ADR.
Decision
- Flex widths. The grid calls core
applyFlexWidthswith theclientWidthof the scroller. It does this in the next animation frame after aResizeObservercall or a change of the column sizes, visibility or order. A write in theResizeObservercallback can show a scroll bar and loop. A key of the width and the sizes of the columns that are not flex skips a pass with the same input. A grid with no flex column does no pass. - A resize takes a column out of flex, as in AG Grid. The grid keeps a set of these column IDs. The next pass gives the column no share, so it keeps its new size, and the other flex columns share the rest. An auto-size does the same.
- Auto-size measures the DOM. For each rendered cell of the column, the measure is the
width of a
Rangeover the cell content (for a header: the label and the slot), plus the padding and the border. ARangegives the content width, also when the content is narrower than the cell, so a column can shrink. The grid divides by the scale of the page. Only the rendered rows and columns count: a column that is not rendered keeps its size. AG Grid also measures only the rendered rows. - Auto-size API. A double click on the separator sizes its column.
GridStateHandle.autoSizeColumns(columnIds?)sizes all columns or some. The handle is the API of the grid already (scrollToCell). - Auto-generated columns.
autoColumns(rows, { sample, types })makes a column def for each key of the first rows. The header is the key in words (owner_name→Owner name). A key gets the first type whoseisValuetakes its first value. A table with no leaf columns gets these columns after the render in which it first has rows, throughtable.setOptions. So rows that load later also get columns. The grid never writes state during render.setOptionsis not inGridTable, because its updater type is the options type of the app; the grid finds it at run time. - Column types.
meta.columnTypeis a structural type (format(value, locale)), so@ember-lattice/emberdoes not depend on@ember-lattice/column-types. A cheap cell showstype.format(value, @locale).meta.lattice.formatwins. - Aligned grids use a shared handle.
LatticeGrid.alignment()gives aGridAlignment. Each grid with it as@alignedjoins it. A grid that joins takes the column state of the first grid. A change of the sizes, the order state or the visibility goes to the other grids, for the column IDs that they share. Each grid compares before it writes, so the change stops after one round. The modifier that sends a change does its work after the render ends: a modifier tracks what it reads, and a read of the other table in it made a render loop. The order is the visible order of the columns, not the column order atom. A horizontal scroll setsscrollLeftof the other grids when it is different. A handle, not@alignedWith={{grid}}: two or more grids can share it, and no grid needs a reference to another component. - The external filter is one function.
@externalFilteris(row) => boolean. When the arg is given, the filter is on; AG Grid needs two callbacks for this. The grid filters the rows of the row model (not the pinned rows) in itsrowsgetter, so tracked state that the function reads filters again with no "filter changed" call. Limit: the engine groups before this filter, so group rows keep their counts, and select-all and export use the table. - Notes in the grid.
@noteshasnoteAt(rowId, columnId), as@findhasmatchAt. A cell with a note hasdata-note; the theme draws a corner mark. Hover or focus showsdiv.lt-note role="note"in.lt-grid-root, outsiderole=grid, under the cell. The cell getsaria-describedby, with the tooltip ID too when both are open. Then the note goes under the tooltip, so the two do not overlap. The note follows its cell on a scroll, and hides when the cell is not rendered. The sheet can use@notesin place of its own note box. - Hooks.
GridContextMenuApi.selectiongives the ranges, also the grid range of@rowModel.meta.lattice.headerLabel(Args{ column, label }) replaces the label text. A click on a control in it does not sort or drag. F2 and Escape work as in the header slot.- The row number cells are
role="rowheader". The keys, the focus and the harness accept the role. placeRowEditorfinds the row and the cells of this grid only, with:scope >paths, ascellElementdoes.placeEditoralready usedcellElement.- The sticky group rows read a group end map that the grid makes in one pass when the rows change. Before, each range change scanned each open group to its end.
- A
contextmenuevent ends a long press that runs, so Android opens one menu.
- A covered cell under a merge of many columns leaves a spacer as wide as the column span of the merge, not one column. Before, the cells after a merge of more than one row and more than one column moved to the wrong place in the rows under the anchor. This changes ADR 0018, item 11.
- The sheet merge box is gone. The sheet uses real spans, so the theme has no
.lt-sheet-mergerule. The theme styles the function help list (.lt-sheet-help) of the formula bar. - The row slot attribute is
data-lt-slot. Joinery's scoped preflight matches[data-slot]and[data-slot] *. The rename stops it on rows and cells (research S13, C1). The harness does not read the attribute.
Consequences
- The matrix rows "Flex widths", "Auto-size", "Auto-generated columns", "Aligned grids", "External filter", "Notes" and "Column data types" are "done", each with its Grid test.
- A theme fixture (
fixtures/grid-rows.html) tests the row feature CSS. It found two faults:editing.cssmade full-width cellsposition: relative(not sticky), and forced colors removed the drag handle dots. - The external filter, the auto-size measure and the note position have
shortcut:comments or limits in this ADR.
Confirmation
Not recorded in the original ADR.
Interview record
Each question of the interview with its answer and its source. A fact from the code or a document, a question that the author did not ask, and an assumption are rows too.
| Question | Answer | Source |
|---|---|---|
| Where does the text of this page come from? | From the Markdown file docs/adr/0023-grid-columns-and-hooks.md at commit 4c77ac4. The text of each section is the text of the Markdown file. A section that the Markdown file does not have says so. | Document: docs/adr/0023-grid-columns-and-hooks.md |
Changelog
| Date | Author | Change |
|---|---|---|
| 2026-12-02 | Joe Gaudet | Status in the Markdown file: accepted, 2026-12-02. |
| 2026-12-03 | Joe Gaudet | Commit 7ce4af2: Lattice 1.0 (#1) |
| 2026-12-04 | Joe Gaudet (agent) | Converted from docs/adr/0023-grid-columns-and-hooks.md to this page. The text is the text of the Markdown file. |
The adr skill of skillsaw wrote this page. The HTML in this file is the source of truth. The diagrams are the Mermaid sources in it.