'Why is the request param of my ag-grid undefined?

Hey I'm testing the ServerSide RowModel of Ag-Grid with Angular. I will add my response from the server later, since my goal is to learn the framework first. I want to print out the request parameter of my grid in console.log(Start Row: ${params.request.startRow}, End Row: ${params.request.endRow}) but I get undefined for both params. Does anyone know the reason?

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);
  }

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>



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source