Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeTableComponent ¶
func MakeTableComponent[T any](componentName string) vdom.Component[TableProps[T]]
Types ¶
type CellContext ¶
type CellContext[T any] struct { Data T `json:"row"` Value any `json:"value"` RowIdx int `json:"rowIdx"` ColIdx int `json:"colIdx"` Column string `json:"column"` }
Core table types
type HeaderContext ¶
type PaginationConfig ¶
type RowContext ¶
type TableColumn ¶
type TableColumn[T any] struct { AccessorKey string `json:"accessorKey"` // Field name in the data AccessorFn func(rowCtx RowContext[T]) any `json:"-"` // Function to extract value from row Header string `json:"header"` // Display name Width string `json:"width,omitempty"` Sortable bool `json:"sortable"` CellClassName string HeaderClassName string CellRender func(ctx CellContext[T]) any `json:"-"` // Custom cell renderer HeaderRender func(ctx HeaderContext) any `json:"-"` // Custom header renderer }
Column definition - similar to TanStack Table
type TableProps ¶
type TableProps[T any] struct { Data []T `json:"data"` Columns []TableColumn[T] `json:"columns"` RowRender func(ctx RowContext[T]) any `json:"-"` // Custom row renderer (overrides columns) RowClassName func(ctx RowContext[T]) string `json:"-"` // Custom row class names OnRowClick func(row T, idx int) `json:"-"` OnSort func(column string, direction string) `json:"-"` DefaultSort string `json:"defaultSort,omitempty"` Pagination *PaginationConfig `json:"pagination,omitempty"` Selectable bool `json:"selectable"` SelectedRows []int `json:"selectedRows,omitempty"` OnSelectionChange func(selectedRows []int) `json:"-"` }
Table props
Click to show internal directories.
Click to hide internal directories.