注意:这是关于所有行的核心选项和API属性。其他表格功能还提供了更多选项和API属性。
所有行对象都具有以下属性:
id
id: string
通过options.getRowId
选项解析的行的唯一标识符。默认为行的索引(如果是子行,则为相对索引)。
depth
depth: number
行的深度(如果是嵌套或分组的)相对于根行数组。
index
index: number
行在其父数组中的索引(或根数据数组中的索引)。
original
original: TData
提供给表格的原始行对象。
🧠 如果行是分组行,则原始行对象将是组中的第一个原始行。
parentId
parentId?: string
如果是嵌套的,则为该行的父行id。
getValue
getValue: (columnId: string) => any
返回给定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>[]
返回行的所有单元格。