0
我正努力在訂閱observable時刷新ag-grid。Observable訂閱刷新ag-grid
我有以下一段代碼,效果很好。
this.marketConfigs = this._regionProductConfigService.getMarketConfig();
this.gridOptions.columnDefs = this.createColumnDefs();
this.gridOptions.rowData = this.marketConfigs;
但因爲我試圖把在AG-格列下拉,我想列配置,一旦我們收到的數據被創建。所以我改變了以下代碼:
this._refDataService.getAllCurrencies().subscribe(
(data: ICurrency[]) => {
this.financingCurrencies = data;
this.marketConfigs = this._regionProductConfigService.getMarketConfig();
this.gridOptions.columnDefs = this.createColumnDefs();
this.gridOptions.rowData = this.marketConfigs;
this.gridOptions.enableColResize = true;
this.gridOptions.api.refreshView();
},
err => console.log(err)
);
但它不顯示任何東西在網格中。有人可以幫忙嗎?
你可以檢查是否有draw()方法嗎?所以有點像this.gridOptions.draw() –
不,沒有draw()方法。理想情況下,this.gridOptions.api.refreshView()應該強制網格重繪自己。 –