使用Observables时,ag-grid不刷新 [英] ag-grid does not refresh when using Observables

查看:146
本文介绍了使用Observables时,ag-grid不刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Angular-2 Ag-grid与Observable绑定。第一次加载网格时,网格中的数据将按预期显示。以下是执行此操作的代码:

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

我已经在组件中的typescript类的构造函数中设置了网格选项。



现在,当我更新可观察的数据时,我看到更新的更改传播到设置(如上所示),但是网格不会使用新数据刷新。 / p>

我尝试了所有可能的方法,使用gridOptions.api.refreshView()刷新网格。我还尝试了此处给出的解决方案。不幸的是,它们都不起作用。



任何帮助都值得赞赏。
谢谢。

解决方案

我将gridOptions设置为 deltaRowDataMode:true getRowNodeId:data => data.id 检查 https://www.ag-grid.com/javascript-grid-data-update/#method-3-delta-row-data 了解更多信息


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.

解决方案

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

这篇关于使用Observables时,ag-grid不刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆