<kern-table-columns>
Column chooser for a kern-table in data mode: a checkbox per column to show or hide it and buttons to move it up or down (also Alt+↑/↓ in its row). Pinned columns are marked and move within their group. It edits a column state and reports it with kernColumnsChange; the app sets it on the table (table.columnState = e.detail.state) and stores it if it wants. Put it in a kern-drawer, a dialog or a panel next to the table.
Examples
Choose and order columns
kern-table-columns edits a column state for a kern-table in data mode: a checkbox per column shows or hides it, the arrow buttons (or Alt+↑/↓ anywhere in its row) move it. The focus stays on the button pressed, and the new position is announced. Pinned columns are marked and move within their group; columns with hideable: false and the last min-visible-columns can't be hidden. Give it the table's columns and set the state it reports with kernColumnsChange on the table; storing it is up to the app.
Properties
columnStateKernColumnState[] | undefined
The column state shown; changed by the user unless kernColumnsChange is cancelled. Default: from columns.
columnsKernTableColumn<any>[]
The table's columns (key, label, hideable, default hidden and pinned).
labelstring | undefined
Accessible name of the list.
labelMoveDownstring | undefined
Accessible name of a move-down button; {label} is the column.
labelMoveUpstring | undefined
Accessible name of a move-up button; {label} is the column.
labelMovedstring | undefined
Announced after a move; {label}, {position} and {count} are replaced.
labelPinnedEndstring | undefined
Mark of a column pinned to the end.
labelPinnedStartstring | undefined
Mark of a column pinned to the start.
minVisibleColumnsnumber
At least this many columns stay visible: their checkboxes can't be cleared.
Events
kernColumnsChangeCustomEvent<{ state: KernColumnState[]; }>
A column was shown, hidden or moved. state is the complete new column state. Cancelable: preventDefault() keeps it as it is.