Data Table Header
Describes a column in the DataTable.
Parameters
Stable unique identifier for this column. Also used for sorting.
Text label shown in the default header when headerContent is not provided.
Extractor invoked for each row item to produce a displayable value.
Whether this column supports sorting via the built-in header interactions.
Fixed width for the column. If null, the column is laid out with weight to fill space.
Horizontal alignment for header text and default cell text.
When true, the column is frozen (pinned) to the left and does not scroll horizontally. Frozen columns must have an explicit width; DataTable throws if one does not.
When false, the column is excluded from rendering. Defaults to true.
Maximum lines for default text rendering. Defaults to Int.MAX_VALUE.
Text overflow strategy for default text rendering.
Optional custom comparator for sorting. When provided, takes precedence over the default Comparable-based sort.
Optional nested headers. When provided, this header becomes a group: it is drawn as a band above its children, spanning them, and only the leaf headers render as actual columns. A group's own value, width, and sorting settings are ignored — it takes its width from the leaves beneath it, which must be either all fixed-width or all weighted.
Optional composable to fully customize the header cell for this column.
Optional composable to fully customize each body cell for this column.
Whether cells in this column can be edited in place. Declaring any editable column turns on DataTable's cell-level focus and grid keyboard navigation, and requires an onCellEdit callback for the edit to go anywhere — the table reports edits, it never mutates your items.
Checks a value the user is trying to commit, returning an error message to reject it or null to accept. A rejected commit keeps the editor open with the message on DataTableState.editError. This is the guard that stops unparseable text ever reaching onCellEdit.
Optional composable replacing the built-in text field — a dropdown, a date picker, a lookup. It is handed the row and a CellEditController to commit or cancel with, and is expected to take keyboard focus itself.
Turns the value value extracted into the text the cell shows. Formatting here rather than inside value is what keeps a column's raw value raw: { it.salary } reads $92,000 and still sorts numerically, with no comparator to make up for a value that had become a string. Clipboard copy takes the formatted text — what you see is what you copy — while an editor still opens on the raw value, or on editValue. Ignored when cellContent draws the cell itself, though copy still uses it. DataTableFormatters has ready-made ones for money, numbers, percentages, dates, and booleans.
Whether this column gets a field in the filter row. Declaring any filterable column is what makes DataTable draw that row at all.
Hint text shown in an empty filter field. Worth setting where the column title alone does not say what to type.
Decides whether one item matches a query. The default is a case-insensitive "contains" against both the text the cell shows and the raw value, so a salary reading $92,000 is found by 92,0 and by 92000 alike. Supply one for anything else — a number range, a date window, a set of accepted codes.
Optional composable replacing the built-in text field — a dropdown of the values that occur, a range picker, a tri-state flag. It is handed a ColumnFilterController to read the current query from and to set the new one with, and supplying it opts the column into the filter row on its own.
Whether a single click on an editable cell opens its editor, instead of moving the cell cursor and waiting for Enter, F2, or a double-click. With DataTableEditors.checkbox it makes one click toggle the value. Shift-clicks still extend the selection without editing.