Row Models

ag-Grid can be configured to retrieve rows from the server in different ways. You should choose the way which best suits your needs. The supported ways are as follows:

  • In Memory: This is the default. The grid will load all of the data into the grid in one go.
  • Pagination: This is standard pagination, the grid will load the data in pages and provide next & previous buttons.
  • Virtual Paging: This will present the data to the user in one screen with a vertical scrollbar. The grid will retrieve the data from the server in blocks using a least recently used algorithm to cache the blocks on the client.
  • Viewport: This will present the data to the user on screen with a vertical scrollbar. The grid will inform the server exactly what data it is displaying (first and last row) and the server will provide data for exactly those rows only.

Row Model Summary

Model Grouping Aggregation Filtering Sorting Server State Availability
In Memory Yes Yes Yes Yes No Free
Pagination Per Page Per Page Per Page or Server Side Per Page or Server Side No Free
Virtual Paging No No Server Side Only Server Side Only No Free
Viewport No No Server Side Only Server Side Only Yes Enterprise

Setting Row Model

What row model you use is set as a grid property. Set it to one of {normal, pagination, virtual, viewport}. The default is normal.

When to Use

Which row model you use will depend on your application. Here are some rules of thumb:

  • If you are not sure, use default In Memory. The grid can handle massive (100k+) amounts of data. The grid will only render what's visible on the screen (40 rows approx???) even if you have thousands of rows returned from your server. You will not kill the grid with too much data - rather your browser will run out of memory before the grid gets into problems. So if you are unsure, go with In Memory row model first and only change if you need another.
  • If you do not want to shift all the data from your server to your client, as the amount of data is too large to shift over the network or to extract from the underlying datasource, then use either pagination or virtual paging. Each one takes data from the server in blocks. Pagination allows the user to view the data using next / previous buttons. Virtual pagination allows the user to view the data with a vertical scroll.
  • If you want the server to know exactly what the user is looking at, then use viewport, as this will put the state on the server side. This is best when you have changing data and want to push updates to the client when the server side data changes.

Next Steps

For In Memory (ie normal) there is nothing else to do. This is the default for the grid and no other configuration is required.

For Pagination and Virtual Paging you need to create a Datasource. Then go to the section either on Pagination or Virtual Paging. A datasource can be used by pagination or virtual paging.

For Viewport go to the section Viewport where you will learn how to create a Viewport Datasouce. A ViewportDatasource is used by viewport only.