Table#

Github

Table is a core component for displaying row and column data and structured information

import { Table, Column } from "wis/table";

Height Settings#

For convenience, we provide three common table height setting methods

Follow Content Height#

Fixed Table Height#

Auto Fill Container#

Data Loading#

In addition to static data loading through the data property, the table component can also implement server-side data loading by passing a data request function to the data property

Server-side Loading#

Manual Trigger#

Sorting Functionality#

The table component supports single-column sorting, multi-column sorting, and sorting mode configuration, while also supporting server-side sorting

Single Column Sorting#

Multi-column Sorting#

Configure multi-level sorting functionality through the priority field of sortable columns, where smaller values have higher priority

Sorting Mode#

The table supports two sorting modes: reset and toggle mode, with reset being the default

Server-side Sorting#

Server-side sorting also supports single-column sorting, multi-column sorting, and sorting mode configuration. Here's an example of single-column server-side sorting

Header Settings#

Fixed Header#

There are two ways to implement fixed headers: the first is by setting fixed table height, and the second is by setting auto fill container.

Multi-level Header#

Header Merging#

Column Settings#

Column Fixed#

Middle Column Fixed#

API Reference#

Table#

NameTypeDefaultDescription
titlestringnoneTable title
dataR[] TableAjaxnoneTable data
paramsobjectnoneParameters passed when calling TableAjax
separatorstripe bordernoneTable row separator
rowKeystring (record: R) => stringkeyRow unique key
sortModereset togglenoneSorting mode
manualbooleanfalseWhen configuring TableAjax, whether to manually trigger table data loading
heightnumber autononeTable height control, auto follows container height
onSortChange(sort?: Sort | Sort[]) => voidnoneEvent triggered when sorting changes
onLoad(response: TableResponse<R>) => voidnoneEvent triggered when asynchronous data loading is complete

Column#

NameTypeDefaultDescription
titlestringnoneColumn title
namestringnoneColumn name
sortableboolean Compare<R> Sortable<R>noneConfigure column sorting rules
ellipsisbooleannoneSet text overflow ellipsis
minWidthnumbernoneColumn minimum width
widthnumbernoneColumn width
maxWidthnumbernoneColumn maximum width
alignleft center rightnoneColumn content alignment
visiblebooleannoneControlled mode to control column display state
defaultVisiblebooleannoneUncontrolled mode to control column default display state
pinnedleft rightnoneControlled mode to control column fixed position state
defaultPinnedleft rightnoneUncontrolled mode to control column default fixed position state
colSpannumbernoneSet column header merge count

Methods#

Method NameDefinitionDescription
query(option?: QueryOption<P>) => Promise<TableResponse<R>>Trigger table data loading
getData() => R[]Get table data