I'm learning how to use ag-grid in react and I saw a problem:
when I'm getting data from a web api it cames very results, like 8600 results
Question:
I want to know if it is possible, for example, to get just 20 results per page instead get them all at once or it is possible just from an api prepared with this insight
some code:
//http request
onGridReady = params => {
this.gridApi = params.api;
this.gridColumnApi = params.columnApi;
const httpRequest = new XMLHttpRequest();
httpRequest.open( "GET", "https://raw.githubusercontent.com/ag-grid/ag-grid/master/packages/ag-grid-docs/src/olympicWinners.json" );
httpRequest.send();
httpRequest.onreadystatechange = () => {
if (httpRequest.readyState === 4 && httpRequest.status === 200) {
updateData(JSON.parse(httpRequest.responseText));
}
};
const updateData = data => {
this.setState({ rowData: data });
};
};
//ag grid
render() {
return (
<div className="ag-theme-balham" style={{ height: '700px', width: '95%' }}>
<AgGridReact
columnDefs={this.state.columnDefs}
defaultColDef={this.state.defaultColDef}
defaultColGroupDef={this.state.defaultColGroupDef}
columnTypes={this.state.columnTypes}
rowData={this.state.rowData}
onGridReady={this.onGridReady}
pagination={true}
paginationPageSize={20}
/>
</div>
);
}