I\'m attempting to implement ag-grid server side row model as described in their documentation here. What I\'m attempting to do is pass the api call along with it\'s parameters
You need to use Arrow function to access the properties of the parent scope. Check the code below for getRows
and setTimeout
.
var dataSource = {
rowCount: null,
getRows: (params) => {
setTimeout(() => {
let serviceParams = this.props.dataServiceParams ? this.props.dataServiceParams.slice() : {};
serviceParams.pageSize = this.state.paginationPageSize; // this will be the rows returned per service call
serviceParams.index = // if there is more than 1 page for the pagesize this is the index/page to return.
serviceParams.sortAndFilters = gridUtility.combineSortAndFilters(params.sortModel, params.filterModel);
this.props.dataService(serviceParams)
.then(out => {
var rowsThisPage = out;
var lastRow = -1;
params.successCallback(rowsThisPage, lastRow);
});
params.context.componentParent.gridApi.hideOverlay();
}, 500);
}
};