Currently experimenting with the ServerSide RowModel of Ag-Grid in combination with Angular. Planning to add server response later on, but for now focusing on familiarizing myself with the framework. Struggling to retrieve request parameter values from my grid using
console.log(Start Row: ${params.request.startRow}, End Row: ${params.request.endRow})
as I keep getting undefined for both params. Any insights into what might be causing this issue?
export class TestComponent implements OnInit {
gridApi!: GridApi;
columnDefs: ColDef[] = [
{field: 'firstName'},
{field: 'lastName'},
];
gridOptions: GridOptions = {
columnDefs: this.columnDefs,
rowModelType: 'serverSide',
cacheBlockSize: 5,
maxBlocksInCache: 1,
sideBar: true,
}
constructor() {
}
ngOnInit(): void {
}
dataSource: IServerSideDatasource = {
getRows: (params: IServerSideGetRowsParams) => {
console.log(`Start Row: ${params.request.startRow}, End Row: ${params.request.endRow}`)
params.success({
rowData: [{firstName: "Test", lastName: "test"},
{firstName: "test", lastName: "test"},]
})
}
}
onGridReady(event: AgGridEvent) {
this.gridApi = event.api
this.gridApi.setServerSideDatasource(this.dataSource);
}
Here's a snippet from my TestComponent html file:
<ag-grid-angular
style="width: 100%; height: 800px"
class="ag-theme-alpine-dark"
[gridOptions] = "gridOptions"
(gridReady)="onGridReady($event)"
>
</ag-grid-angular>