Skip to content

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)
MethodReturnsNotes
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.

MethodReturnsNotes
addColumn(col: DataTableColumn)void
setColumns(cols: DataTableColumn[])voidReplaces all columns.
setItems(items: any[])voidReplaces the data and refreshes the display.
bindItems(arr: ReactiveArray&lt;any&gt; | null)voidBinds 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)voidThe 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)voidA function to filter visible rows; null clears it. The scroll position resets to the top.
bindSearchFilter(ref: Ref&lt;string&gt;)voidThe search text follows the ref; searchable columns with a searchValue are matched.
bindSearchInput(ti: TextInput)voidBinds a TextInput's value to the search filter.
setColumnFilter(colKey: string, values: string[])voidOnly rows whose column searchValue is in values are shown.
clearColumnFilter(colKey: string)void
resetFiltersAndSort()voidClears 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)voidWhen registered, the table does NOT sort internally: the caller owns sort logic.
selectedIndexesCopy()int[]
bindSelectedIndexes(getFn: Function | null, setFn: Function | null)voidSelection follows external getter / setter functions.
setSelectedIndexes(indexes: int[])voidReplaces the selection from external code.
clearSelection()void
selectRow(index: int)void
toggleRowSelection(index: int)void
selectAll()voidMulti-selection mode only; no-op otherwise.
isSelected(dataIdx: int)boolean
scrollToRow(index: int)voidScrolls so the given original-array index is visible.
scrollToTop()void
scrollToBottom()void
bindScrollPos(ref: Ref&lt;float&gt; | null)voidThe scroll position follows the ref (Go never wrote back to it).
setSortedColumn(key: string, dir: int)voidSets a single sort column and direction; clears any multi-column sort.
sortedColumnKey()stringThe 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)voidThe default sort applied when sortKeys is empty (on setItems / bindItems).
setOnMultiSort(fn: Function | null)void
rebuild()voidA full re-layout on the next frame (recreates all row slots).
refresh()voidA 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)voidOpens a popover with a checkbox for each unique value in the column.
closeFilterPopover()voidCloses 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.

MethodReturnsNotes
setValue(g: Gradient)voidSets the current gradient without firing onChange.
getValue()GradientA copy of the current gradient.
bindValue(ref: Ref&lt;Gradient&gt;)voidThe editor writes back to the ref on every change; external writes update the editor.
setOnChange(fn: Function | null)voidInvoked on every edit (colour change or mode switch).
setAllowedModes(modes: int[])voidRestricts which modes appear in the selector. If the current mode is not listed the editor switches to the first allowed mode.
setShowModeSelector(show: boolean)voidShows or hides the H | V | 4-corner selector row.
setSize(w: float, h: float)void