@@ -33,6 +33,7 @@ export interface BodyRowProps<RecordType> {
33
33
rowExpandable : ( record : RecordType ) => boolean ;
34
34
indent ?: number ;
35
35
getRowKey : GetRowKey < RecordType > ;
36
+ childrenColumnName : string ;
36
37
}
37
38
38
39
function BodyRow < RecordType extends { children ?: RecordType [ ] } > ( props : BodyRowProps < RecordType > ) {
@@ -49,6 +50,7 @@ function BodyRow<RecordType extends { children?: RecordType[] }>(props: BodyRowP
49
50
rowComponent : RowComponent ,
50
51
cellComponent,
51
52
measureColumnWidth,
53
+ childrenColumnName,
52
54
} = props ;
53
55
const { prefixCls } = React . useContext ( TableContext ) ;
54
56
const {
@@ -84,7 +86,7 @@ function BodyRow<RecordType extends { children?: RecordType[] }>(props: BodyRowP
84
86
const rowSupportExpand = expandableType === 'row' && ( ! rowExpandable || rowExpandable ( record ) ) ;
85
87
// Only when row is not expandable and `children` exist in record
86
88
const nestExpandable = expandableType === 'nest' ;
87
- const hasNestChildren = 'children' in record ;
89
+ const hasNestChildren = childrenColumnName in record ;
88
90
const mergedExpandable = rowSupportExpand || nestExpandable ;
89
91
90
92
// =========================== onRow ===========================
@@ -224,7 +226,7 @@ function BodyRow<RecordType extends { children?: RecordType[] }>(props: BodyRowP
224
226
// ========================= Nest Row ==========================
225
227
let nestRowNode : React . ReactElement [ ] ;
226
228
if ( hasNestChildren && expanded ) {
227
- nestRowNode = ( record . children || [ ] ) . map (
229
+ nestRowNode = ( record [ childrenColumnName ] || [ ] ) . map (
228
230
( subRecord : RecordType , subIndex : number ) : React . ReactElement => {
229
231
const subKey = getRowKey ( subRecord , subIndex ) ;
230
232
0 commit comments