我使用基于ag-grid树的数据层次结构。 我将以下JSON传递给 rowData :
[
{
Hierarchy: ['Documents'],
ItemType: 1 // internal use
},
{
Hierarchy: ['Documents_Folder', 'Sub_Folder'],
ItemType: 1 // internal use
},
{
Hierarchy: ['Documents_Folder', 'Sub_Folder', 'File'],
ItemType: 1 // internal use
}
]
当然还有 treeData :
在传递到上下文菜单的操作回调中,我执行以下操作:
//the relevant context object passed with the context menu array
//The action is done on the top Hierarchy object, and it is redrawn after deletion
{
name: 'Delete',
action: () => {
const selectedRowData = params.node.data;
this.gridApi.updateRowData({remove: [selectedRowData]})
}
}
这似乎可以完成一秒钟的工作,但是不到一秒钟之后,节点是否被重新绘制到树的底部?我想念什么?