如何强制 ag-grid 滚动到选定/突出显示的行位置

Ses*_*dri 6 javascript css jquery angularjs ag-grid

我们正在使用ag-grid,我需要根据ag-grid. 请找到下面的 plunkr 并单击source_id哪个是编辑页面,我需要根据窗口弹出屏幕上的选定/突出显示行显示滚动条。

在我的代码中滚动条正在工作,但它没有根据子窗口中选定/突出显示的行显示确切的滚动条位置。并请提供输入以使用ag-grid.

网址

注意:它必须像“ag-body-viewport”div 类中选定的行位置一样自动滚动。

请按照以下步骤操作:

1)In plunker click on preview button.
2)Click on any source_id in ag-grid.
3)Once click the source_id popup window will be displayed.
4)In popup window another grid will be displayed with highlighted row with respective of   source_id.
5)My query is like in this particular window ,how to scroll the scroll bar automatically as per highlighted/selected row postition .
Run Code Online (Sandbox Code Playgroud)

Awa*_*oof 5

如果您查看ag-grid api滚动部分,您将了解如何处理它。

您可以将 getRowStyle 函数更新为如下所示:

  function getRowStyle(params) {
    ....
      if (params.data.source_id.trim() === $scope.source_id.trim()) {
        colorToReturn = {
          'background-color': 'orange'
        };
        $scope.gridOption.api.ensureIndexVisible(Number(params.data.source_id));
      }
    ....
  };
Run Code Online (Sandbox Code Playgroud)