Composites: API
This page is generated from the willowui source. It lists each public class with its constructor, its setter-style methods and its callback fields. The guide page for this family explains how to use them. Methods the generator skips (internal handlers, layout and draw steps) are still reachable but are not part of the everyday surface.
CellCoord
Source: src/widgets/composites/datatable.tks.
ts
new CellCoord(row: int, col: int)SortKey
Source: src/widgets/composites/datatable.tks.
ts
new SortKey(colKey: string, dir: int)DataTableColumn
Source: src/widgets/composites/datatable.tks.
ts
new DataTableColumn(key: string, header: string)| Method | Returns | Notes |
|---|---|---|
isHidden() | boolean |
SelectionColumnState
Source: src/widgets/composites/datatable.tks.
Shared mutable state of a SelectionColumn, stored in DataTableColumn.internal so the table can wire itself in when the column is added.
ts
new SelectionColumnState(visible: Ref<boolean>, multi: Ref<boolean>)DataTable
Source: src/widgets/composites/datatable.tks. Extends Component.
ts
new DataTable(name: string, rowHeight: float)Callback fields: onSort, onMultiSort, onCellClick, onCellDoubleClick, onSelectionChanged.
| Method | Returns | Notes |
|---|---|---|
addColumn(col: DataTableColumn) | void | |
setColumns(cols: DataTableColumn[]) | void | Replaces all columns. |
setItems(items: any[]) | void | Replaces the data and refreshes the display. |
bindItems(arr: ReactiveArray<any> | null) | void | Binds to a ReactiveArray: array changes are reflected on the next frame. Pass null to detach. |
setRowHeight(h: float) | void | |
setHeaderHeight(h: float) | void | |
setShowHeader(v: boolean) | void | |
setShowScrollBar(v: boolean) | void | |
setZebraStriping(v: boolean) | void | |
setShowColumnDividers(v: boolean) | void | |
setShowRowDividers(v: boolean) | void | |
setScrollMode(m: int) | void | |
setFont(family: string, size: float) | void | The font family (registered name) and size for header text and default cell labels. Call before setItems / bindItems so cells pick it up. |
setSelectionMode(m: int) | void | |
setRowClickSelects(v: boolean) | void | |
setOnSortScroll(v: int) | void | |
setFilterFunc(fn: Function | null) | void | A function to filter visible rows; null clears it. The scroll position resets to the top. |
bindSearchFilter(ref: Ref<string>) | void | The search text follows the ref; searchable columns with a searchValue are matched. |
bindSearchInput(ti: TextInput) | void | Binds a TextInput's value to the search filter. |
setColumnFilter(colKey: string, values: string[]) | void | Only rows whose column searchValue is in values are shown. |
clearColumnFilter(colKey: string) | void | |
resetFiltersAndSort() | void | Clears sort keys, filters, search and column filters, scrolls to top and rebuilds. |
setOnCellClick(fn: Function | null) | void | |
setOnCellDoubleClick(fn: Function | null) | void | |
setOnSelectionChanged(fn: Function | null) | void | |
setOnSort(fn: Function | null) | void | When registered, the table does NOT sort internally: the caller owns sort logic. |
selectedIndexesCopy() | int[] | |
bindSelectedIndexes(getFn: Function | null, setFn: Function | null) | void | Selection follows external getter / setter functions. |
setSelectedIndexes(indexes: int[]) | void | Replaces the selection from external code. |
clearSelection() | void | |
selectRow(index: int) | void | |
toggleRowSelection(index: int) | void | |
selectAll() | void | Multi-selection mode only; no-op otherwise. |
isSelected(dataIdx: int) | boolean | |
scrollToRow(index: int) | void | Scrolls so the given original-array index is visible. |
scrollToTop() | void | |
scrollToBottom() | void | |
bindScrollPos(ref: Ref<float> | null) | void | The scroll position follows the ref (Go never wrote back to it). |
setSortedColumn(key: string, dir: int) | void | Sets a single sort column and direction; clears any multi-column sort. |
sortedColumnKey() | string | The first sort column key and direction; "" and SORT_DIR_NONE when unsorted. |
sortedColumnDir() | int | |
setSortKeys(keys: SortKey[]) | void | |
getSortKeys() | SortKey[] | |
setDefaultSort(key: string, dir: int) | void | The default sort applied when sortKeys is empty (on setItems / bindItems). |
setOnMultiSort(fn: Function | null) | void | |
rebuild() | void | A full re-layout on the next frame (recreates all row slots). |
refresh() | void | A slot rebuild on the next frame. |
setEmptyComponent(comp: Component | null) | void | |
setSize(w: float, h: float) | void | |
sortKeyIndex(colKey: string) | int | |
sortKeyDir(colKey: string) | int | |
hasSelectionColumn() | boolean | |
openColumnFilterPopover(col: DataTableColumn, colIndex: int) | void | Opens a popover with a checkbox for each unique value in the column. |
closeFilterPopover() | void | Closes the open filter popover, if any. |
GradientEditor
Source: src/widgets/composites/gradienteditor.tks. Extends Component.
ts
new GradientEditor(name: string, family: string, displaySize: float)Callback fields: onChange.
| Method | Returns | Notes |
|---|---|---|
setValue(g: Gradient) | void | Sets the current gradient without firing onChange. |
getValue() | Gradient | A copy of the current gradient. |
bindValue(ref: Ref<Gradient>) | void | The editor writes back to the ref on every change; external writes update the editor. |
setOnChange(fn: Function | null) | void | Invoked on every edit (colour change or mode switch). |
setAllowedModes(modes: int[]) | void | Restricts which modes appear in the selector. If the current mode is not listed the editor switches to the first allowed mode. |
setShowModeSelector(show: boolean) | void | Shows or hides the H | V | 4-corner selector row. |
setSize(w: float, h: float) | void |