Search code examples
angularag-gridag-grid-ng2

Ag-grid batch calls for data loading


I am using ag-grid for display. I don't want to bring complete data in one go. e.g. i want to bring 11-20th page data when user on 10th page How can i implement ?


Solution

  • You can switch to Ag-grid infinite scrolling row model.

    For more details on row models, visit documentation: https://www.ag-grid.com/javascript-grid-row-models/

    i want to bring 11-20th page data when user on 10th page

    I hope you mean to load 11-20th records when user scrolls to see 10th record.
    For that, set parameters maxBlocksInCache, cacheBlockSize = 10 (to make cache block size 10), infiniteInitialRowCount accordingly.


    Update

    As per ag-grid documentation

    In v9.0 ag-Grid pagination changed from server side pagination to client side pagination. Server side pagination was then removed in v10.1.

    If you were doing server side pagination, we recommend moving to pagination with infinite scrolling as a way of migration to the new mechanism.

    If you were slicing manually the data in your Datasource to mimic pagination done in the browser only, we recommend that you use the default In Memory Row Model and set the row data as normal and then set grid property pagination=true.