Ag-Grid Pagination does not work in version (10.1.0) in Angular 2

In our angular 2 application, we used the ag-Grid version (9.1.0) and are now upgrading to (10.1.0). After updating ag-Grid with an implementation of a page that works in version 9.1.0, an error and warning like this are displayed.

Error: ag-Grid: counting does not find a suitable row model for pagination rowModelType
Warning: ag-Grid: you can only use the data source when gridOptions.rowModelType is "infinite"

The code:

<ag-grid-angular #agGrid style="width: 100%; height: 450px;" class="ag-fresh"
                [gridOptions]="myGridOptions" 
                [rowData]="rowData"

                [datasource] = "userGridDataSource"
                enableColResize    
                enableSorting
                enableFilter                   
                > </ag-grid-angular> 

this.myGridOptions = {

        pagination: true,
        rowModelType: 'pagination',
        paginationAutoPageSize: true,
        rowSelection: 'single'
    };  

getUserdetails() {
    this.userGridDataSource = {
        getRows: (params: any) => {
            this.mapuserdetails(params.successCallback);
        }
    }
}

private mapuserdetails( callback: any) {
    this.http.get('http://localhost:62807/api/student')
        .subscribe(res => callback(res.json()), err => { });
}    
0
source share

Source: https://habr.com/ru/post/1691163/


All Articles