Force datasource to reload data in Angular 2 grid

2019-07-27 06:23发布

I am using Angular 2 and have a grid (ag-grid-angular) with enableServerSideSorting=true and it's working fine only for the first time: the data is loaded and placed in the grid view as expected. When I click on a column to sort that column (which happens automatically) the data is fetched again by calling getRows(params).

The problem is that I have several other input fields:

  • Tabs: to change the type of elements displayed (for example persons or cars).
  • Text field: which is used to enter search criteria.

When I change these input fields, how can I force datasource to collect data again from the server? If I change the tab or search field, then the correct data is only fetched again after I press on one of the columns (forcing to sort again).

I tried this.agGrid.api.refreshView() in the method that is triggered by changing the tab, but this ofcourse does not work.

0条回答
登录 后发表回答