以下是所有行的核心选项和 API 属性。更多选项和 API 属性可用于其他表格功能。
所有行对象都具有以下属性:
id: string
id: string
通过 options.getRowId 选项解析出的唯一标识符。默认为行的索引(如果是子行则为相对索引)。
depth: number
depth: number
行相对于根行数组的深度(如果是嵌套或分组行)。
index: number
index: number
行在其父数组(或根数据数组)中的索引。
original: TData
original: TData
提供给表格的原始行对象。
🧠 如果行是分组行,原始行对象将是组中的第一个原始行。
parentId?: string
parentId?: string
如果是嵌套行,此行父行的 ID。
getValue: (columnId: string) => TValue
getValue: (columnId: string) => TValue
返回行中指定列 ID 的值。
renderValue: (columnId: string) => TValue
renderValue: (columnId: string) => TValue
渲染行中指定列 ID 的值,但如果未找到值,将返回 renderFallbackValue。
getUniqueValues: (columnId: string) => TValue[]
getUniqueValues: (columnId: string) => TValue[]
返回行中指定列 ID 的唯一值数组。
type subRows = Row<TData>[]
type subRows = Row<TData>[]
由 options.getSubRows 选项返回和创建的行子行数组。
type getParentRow = () => Row<TData> | undefined
type getParentRow = () => Row<TData> | undefined
返回行的父行(如果存在)。
type getParentRows = () => Row<TData>[]
type getParentRows = () => Row<TData>[]
返回行的所有父行,直到根行。
type getLeafRows = () => Row<TData>[]
type getLeafRows = () => Row<TData>[]
返回行的所有叶子行,不包括任何父行。
originalSubRows?: TData[]
originalSubRows?: TData[]
由 options.getSubRows 选项返回的原始子行数组。
type getAllCells = () => Cell<TData>[]
type getAllCells = () => Cell<TData>[]
返回行中所有的单元格 (Cell)。
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.