Aggrid params sortModel undefined

1.1k Views Asked by At

Hi i am trying to generalize my data source for multiple tables. I am using datasource below and to do what i want i expect aggrid to pass sortModel as params: IGetRowsParams but aggrid doesnt update sort model. If i get sortModel directly from api i get correct sort model. I am using infinite row model.

function createDatasource() {
  return {
    rowCount: null,
    getRows: (params: IGetRowsParams) => {
      const sortModel = this.gridOptions.api.getSortModel();
      const paramsSortModel = params.sortModel 
    }
  }
}
1

There are 1 best solutions below

0
On

If this is still an issue, you can get the SortModel like this :

getRows: function(params) {
        let sortModels = params.sortModel;
}

the gridApi you are trying to use might be outdated in its context. the params.sortModel is an array of objects in this format :

{ 
   colId:"theColumnId",
   sort: "asc or desc"
}