Background
Had upgraded the typescript to 2.6.2 from 2.3.4. Ag grid have compile issue so its upgraded to 15.0.0. After upgrade existing pagination code for ag-grid is not working.
Previous Configuration - ag-grid and pagination works fine
on click search button from form searchCategory() method will be called and load the grid
package.json
"ag-grid": "^8.1.0",
"ag-grid-angular": "^8.1.0",
.....
"typescript": "^2.3.4"
temp.ts
gridOptions = <GridOptions>{
context: {},
paginationPageSize: AppUtils.IR_PAGINATION_SIZE,
/* rowModelType: 'pagination',*/
rowModelType: 'infinite',
pagination: true,
enableServerSideSorting: true,
suppressDragLeaveHidesColumns: true,
onGridSizeChanged: () => {
this.gridOptions.api.sizeColumnsToFit();
},
getRowHeight: () => {
return 32;
},
components: {
getTypeDesc : function(params: any) {
var eDiv = document.createElement('div');
let desc = params.context.typeMaster.filter(function (item: any) {
if (params.data.typeCode === item.typeCode) {
return item.typeDescription;
}
});
eDiv.innerHTML = '<span>' + desc[0].typeDescription + '</span>';
return eDiv;
},
};
typeMaster: TypeMasterModel[];
categoryMaster: CategoryModel[];
category: CategoryModel = new CategoryModel();
severityMaster: SeverityMasterModel[];
selectedRowsValue: number[];
columnDefs: any[] = [
{ headerName: '', field: 'catCode', hide: true },
{ headerName: 'Category', field: 'catDesc', width: 550 },
{ headerName: 'Type', field: 'typeCode', cellRenderer:'getTypeDesc' }
{ headerName: 'PatientID', field: 'patIdMandYn' },
{ headerName: 'EquipmentID', field: 'equipIdMandYn' },
{ headerName: 'WorkorderId', field: 'workOrderMandYn' }
];
action: string = '';
searchCategory() {
let self = this;
let dataSource = {
rowCount: null, //
getRows: (params: any) => {
this.http.get(//server call ).subscribe(res => {
let result = res['result'];
if (result != null && result.paginatedList != null) {
this.totalRecords = result.paginatedList.length;
if (this.totalRecords <= 0) {
this.gridStatusMessageDisplay("");
}
params.successCallback(result.paginatedList, result.totalRecords);
} else {
this.gridStatusMessageDisplay("");
}
});
}
}
this.gridOptions.api.setDatasource(dataSource);
}
temp.html
New Configuration Details
package.json
ag-grid": "^15.0.0",
"ag-grid-angular": "^15.0.0",
"typescript": "^2.6.2"
test.ts pagination replaced with infinite.
/* rowModelType: 'pagination',*/ rowModelType: 'infinite', pagination: true,
Current Behavior
On call to searchCategory(), server call is made and data loaded into grid with pagination bar. On clicking next in the pagination bar, its not calling the registered data source and halt there.
Expected Behaviour pagination should work properly. Datasource should be called on next & prev and update the grid