Yii2: GridView Speed Optimization

1.3k Views Asked by At

I'm using Yii2 GridView to display data from ActiveDataProvider, the speed of it is working nicely when its pagination-enabled. But when displaying all the rows, everything lags.

I'm using a normal Controller->View flow.

Added Database Caching also Normal Controller

1

There are 1 best solutions below

2
ScaisEdge On

Without pagination al the rows are fetched by the ActiveDataProvider and rendered dy gridview ..

Regardless of performance. This is unhelpful in terms of an acceptable user experience.

If your need is to have client side of the totality of data, it is advisable to avoid the use of the ActiveDataProvider and the gridview, and alternatively use a sql command creat with with createCommand(....); and sql and restrain the result as a JSON structure to process client / side