ArrayDataProvider just name represent based on data array. It is uses $allModels property which occupied all the data and it can be sorted.
You can set $sort and $pagination methods for sorting and pagination behaviors.
How to use Arraydataprovider in Yii2
$query = new Query; $arrayDataProvider = new ArrayDataProvider([ 'allModels' => $query->from('user')->where(['status'=>true])->all(), 'sort' => [ 'attributes' => ['name', 'id'], ], 'pagination' => [ 'pageSize' => 5, ], ]); // get the user query result $user = $arrayDataProvider->getModels();
This post will be very useful to us....i like your blog and helpful to me...
ReplyDeleteHire Yii Developers in India