ag-grid does not refresh when using Observables

允我心安 提交于 2019-12-25 09:26:43

问题


I'm trying to bind the Angular-2 ag-grid with an Observable. The data in the grid is shown as expected when the grid loads for the first time. Following is the code that does this:

  this.settingsService.gen.subscribe(
  (settings) => {
    this.gridOptions.rowData = settings;
  });

I have set the grid options in the constructor of the typescript class in the component.

Now, when I update the data for the observable, I see the updated changes propagated to the 'settings' (shown above), but the grid does not refresh with the new data.

I have tried all possible ways to refresh the grid using gridOptions.api.refreshView(). I also tried the solution given here. Unfortunately, none of them worked.

Any help is appreciated. Thanks.


回答1:


I set the gridOptions deltaRowDataMode: true, and getRowNodeId: data => data.id check https://www.ag-grid.com/javascript-grid-data-update/#method-3-delta-row-data for more info



来源:https://stackoverflow.com/questions/43241173/ag-grid-does-not-refresh-when-using-observables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!