fedemotta / yii2-widget-datatables

DataTables widget for Yii2
MIT License
35 stars 28 forks source link

Using yii pagination #5

Open fedemotta opened 9 years ago

fedemotta commented 9 years ago

After #2 It is necessary the implementation of a pagination in the php layer to avoid memory limit errors.

mtangoo commented 6 years ago

I believe making it working like GridView (pagination and filters) will be great. Right now it loads all data with pagination being false and filters does not work as Yii2 GV.

Especially loading all data once forced me to rollback all uses of this extension (and datatables all together since this was the most compatible extension to GV).

I will try to fix when I have time (currently I don't have) but if you find time to fix it will be great!

gitartur commented 5 years ago

в модели

$dataProvider = new ActiveDataProvider([ 'query' => $query, 'pagination' => [ 'totalCount' => $query->count(), 'pageSize' => 10, ], ]);

$query->offset($dataProvider->pagination->offset)->limit($dataProvider->pagination->limit)->all();