AG Grid Angular, Unable to make collapsed row visible - Stack Overflow

I am using AG Grid library in my angular project. I have 2 grids in a specific view in which I display

I am using AG Grid library in my angular project. I have 2 grids in a specific view in which I display Tree Data. When I click a row on one grid, I have to scroll down to a specific row in another grid. I am using the following code for this purpose:

this.gridApi?.forEachNodeAfterFilter((node) => {
      if (selectedMappedRow?.id=== node.data.id) {
        node.setSelected(true);
        this.gridApi.ensureNodeVisible(node, 'middle');
      }
});

This code works but if the parent of the row that i want to select has been collapsed by the user, the above code does not work. I tried to manually expand all the parent nodes of the selected node but still that did not work.

this.gridApi?.forEachNodeAfterFilter((node) => {
      if (selectedMappedRow?.fragment === node.data.fragment) {
        let parentNode = node.parent;
        while (parentNode) {
          parentNode.setExpanded(true);
          parentNode = parentNode.parent;
        }
        node.setSelected(true);
        this.gridApi.ensureNodeVisible(node, 'middle');
      }
});

Can anyone tell me how to solve this problem.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744345207a4569641.html

相关推荐

  • AG Grid Angular, Unable to make collapsed row visible - Stack Overflow

    I am using AG Grid library in my angular project. I have 2 grids in a specific view in which I display

    8天前
    50

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信