Skip to content

Table Component

Table Component

Table component is used to display structured data, supporting multi-level headers, fixed columns, fixed rows, virtual scrolling, sorting, filtering and other features.

Basic Usage

Basic table for displaying simple table data.

Show CodeArrow
CopyGitHub

Multi-level Headers

Multi-level headers can be created through the children attribute of columns.

Show CodeArrow
CopyGitHub

Virtual Scrolling

When you need to display large amounts of data, virtual scrolling can be enabled to improve performance.

Total Data Count: 5000 records
Show CodeArrow
CopyGitHub

Fixed Columns

Columns can be fixed by setting the fixed attribute in columns.

Show CodeArrow
CopyGitHub

Fixed Rows

Specific rows can be set to be fixed and not move with scrolling through the fixedRow attribute.

Show CodeArrow
CopyGitHub

Sorting and Filtering

Table supports column sorting and filtering functionality.

Show CodeArrow
CopyGitHub

Custom Rendering

Cell and header content can be customized through render and renderHead attributes.

Show CodeArrow
CopyGitHub

Selection and Events

Table supports row selection functionality and various event handling.


Event Log:
Show CodeArrow
CopyGitHub

Style Configuration

Table provides rich style configuration options, including borders, stripes, etc.

Header Background:
Footer Background:
Hover Background:
Border Color:
Stripe:
Show CodeArrow
CopyGitHub

Summary Row

A summary row at the bottom of the table can be set through the summary attribute.

Show CodeArrow
CopyGitHub

Table API

Attributes

AttributeDescriptionTypeAccepted ValuesDefault
columnsTable column configurationarray[]
dataTable data sourcearray[]
heightTable heightnumber
isVirtualizedWhether to enable virtual scrollingbooleanfalse
virtualizedItemHeightVirtual scroll row heightnumber50
headBgColorHeader background colorstring#f5f7fa
footBgColorFooter background colorstring#f5f7fa
hoverBgColorMouse hover background colorstring
borderTable borderstring#dcdcdc68
stripeStripe patternboolean/stringfalse
dbClickAutoWidthWhether to support double-click auto-fit column widthbooleantrue
changeTypeSelection modestringsingle/multiple/nonenone
changeKeySelection identifier fieldstring_checked
fixedRowFixed row methodfunction(index, row)
summarySummary row configurationboolean/function
rowStyleCustom row stylefunction(index, row)
sortMethodCustom sort methodfunction
renderExtendRow expansion contentfunction(row)

Column Configuration

AttributeDescriptionTypeAccepted ValuesDefault
propColumn field namestring
labelColumn titlestring
widthColumn widthnumber
fixedFixed column positionstringleft/right
childrenSub-column configurationarray
sortSort valuenumber
sortableWhether sortablebooleanfalse
filtersFilter configurationarray
renderHeadCustom header renderingfunction(scope)
renderCustom cell renderingfunction(scope)

Events

Event NameDescriptionParameters
checkedSelection event({ row: object, data: array })
checked-allSelect all events({ row: object, _checked: boolean })
change-filterFilter trigger(col: TableColumnsType)
click-rowRow click event(row: object)

Methods

Method NameDescriptionParameters
autoColWidthAuto-adjust column width(prop: string)

Style Variables

The table component uses the following style variables, which can be customized through SCSS variables:

Variable NameDescription
$border-color-defaultDefault border color
$text-color-defaultDefault text color
$bg-color-defaultDefault background color
$bg-color-hoverHover background color
$z-index-showDisplay z-index
$z-index-upUpper layer z-index

Released under the MIT License