1

为了能够添加/删除行,在已经应用分组/排序/过滤的网格中,无需在此行添加/删除重新应用分组/排序/过滤。这是用户可以在一个组上工作,更新一些新值/添加可能仍然不属于同一组分组的新记录被重新应用,但我们不想重新应用分组,因为用户输入会分散在网格中,并且很难审查用户。

  • 我们尝试了什么 ("ag-grid": "^10.0.0", "ag-grid-enterprise": "^10.0.0", "ag-grid-react": "^10.0.0",)

  • 在某个事件/ btn click 上添加一个新行,在一个已经渲染的网格中,在启动时使用一些数据,使用以下(跳过刷新):

    Let newItems = []; let newItem= { id: 'SomethingNewId'+Math.random(), qty: 300, owner:"Deepak Kumar SHarma", isUpdated: true }; newItems.push(newItem); this.gridOptions.api.insertItemsAtIndex(4, newItems, true); // Saying do not refresh the grid

  • 在上述步骤之后,我通过迭代看到已添加了一个 rowNode,但行在网格中不可见。然后尝试仅刷新此新添加的行,使其在网格中可见,期望它无需重新应用此过滤器/排序/过滤:

    let nodes = []; this.gridOptions.api.forEachNode( (node, index) => { if (node.data!==null && node.data!==undefined && node.data.isUpdated===true) { nodes.push(node); } }); this. gridOptions.api.refreshRows(nodes);

  • 但是仍然看不到网格中新添加的行。

  • 如果我只是再次手动将排序/过滤/分组更改为一些新设置,我会在网格中看到新行。
4

0 回答 0