I'm trying to put tree data in antd nested tables,but it always renders empty rows when I clicked the expand button.
Can I use tree data in nested tables and how?And why it happened?
I'm trying to put tree data in antd nested tables,but it always renders empty rows when I clicked the expand button.
Can I use tree data in nested tables and how?And why it happened?
There seems to be two problems here.
children
property will always render its data source in the same table set with parent. You seems to want to render some expandable data which depends on thechildren
property, so the table set will render both the expanded table defined by you and the children data source.You have not prevented node expansion which are doesn't contain children. Before defining the
rowexpandable
handler, all nodes are expandable by default whether their children is empty or not.My solution is to rename the
children
property to prevent children data source rendering and to define arowexpandable
handler to prevent empty children to be expanded.expamle: