angular ag-grid auto bind false

109 views Asked by At

We are using an ag-grid. We would like to have the same functionality as the kendo-grid autoBind: false. So the grid doesn't do anything till a button is clicked and the grid is triggered with server-side infinite-scroll paging.

How can we do this with ag-grid in Angular?

1

There are 1 answers

0
stephan.peters On

We did it like this:

First we assign an EmptyDataSource

import { IDatasource, IGetRowsParams } from "ag-grid-community";

/** Empty datasource used to assign to grid to have no results at first */
export class EmptyDatasource implements IDatasource {
    getRows(params: IGetRowsParams): void {
        params.successCallback([], 0);
    }
}

When the search button is clicked we assign the real datasouce like so (which in this case is the component itself):

this.gridApi.setServerSideDatasource(this);