最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin5浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论