Lzh on GitHub

以下是所有行的核心选项和 API 属性。其他表格功能可能提供更多选项和 API 属性。

行 API (Row API)

所有行对象都具有以下属性:

id

id: string

通过 options.getRowId 选项解析得到的行的唯一标识符。默认为行的索引(如果是子行,则为相对索引)。

depth

depth: number

行的深度(如果嵌套或分组),相对于根行数组。

index

index: number

行在其父数组(或根数据数组)中的索引。

original

original: TData

提供给表格的原始行对象。

如果行是分组行,则原始行对象将是组中的第一个原始行。

parentId

parentId?: string

如果是嵌套行,此行的父行 ID。

getValue

getValue: (columnId: string) => TValue

返回指定 columnId 在行中的值。

renderValue

renderValue: (columnId: string) => TValue

渲染指定 columnId 在行中的值,但如果未找到值,将返回 renderFallbackValue

getUniqueValues

getUniqueValues: (columnId: string) => TValue[]

返回指定 columnId 在行中的唯一值数组。

subRows

type subRows = Row<TData>[]

options.getSubRows 选项返回并创建的行的子行数组。

getParentRow

type getParentRow = () => Row<TData> | undefined

返回行的父行(如果存在)。

getParentRows

type getParentRows = () => Row<TData>[]

返回行的所有父行,一直到根行。

getLeafRows

type getLeafRows = () => Row<TData>[]

返回行的叶子行,不包括任何父行。

originalSubRows

originalSubRows?: TData[]

options.getSubRows 选项返回的原始子行数组。

getAllCells

type getAllCells = () => Cell<TData>[]

返回行的所有 Cell(单元格)。