AG-grid params.successCallback(res.data,res.lastRow) do not get lastRow

Viewed 525

I made AG-grid server side search. The total number of rows is always fixed to 50 whatever i set in successCallback lastRow.

HTML file

<ag-grid-angular
  class="ag-theme-alpine"
  [gridOptions]="gridOptions"
  (gridReady)="onGridReady($event)"
>
</ag-grid-angular>

ts

 gridOptions: any;


//init 
 this.gridOptions = {
      rowModelType: "serverSide",
      paginationPageSize: this.pageSize,
      cacheBlockSize: this.pageSize,
     rowSelection: "single",
    suppressRowClickSelection: true,
    pagination: true,
    columnDefs: [],
    headerHeight: 35,
    rowData: []
    },
  }
    };

 onGridReady(params) {
    this.setDataSource();
  }

private setDataSource(data?: any) {
    ...
      let datasource = new ServerSideService(...);
      this.gridApi.setServerSideDatasource(datasource);
    }
  }

ServerSideService.ts


 getRows(params) {
this.myService
        .searchByRequest(request, this.options.table_name)
        .pipe(
          map((res) => res as { data: Object[]; lastRow: number }),
          delay(300),
        )
        .subscribe(
          (res) => {
            params.successCallback(res.data,res.lastRow);
          },
          (err) => params.fail(),
        );
}

when debugging the result passed to params.successCallback(...) is

code

result on table

table result

0 Answers
Related