Open dsidorenko opened 8 years ago
I saw it, but did not understand where I have to write these lines?)
<?php
namespace rest\versions\v1\controllers;
use yii\data\ActiveDataProvider;
use yii\filters\auth\QueryParamAuth;
use yii\rest\ActiveController;
class ModelsController extends ActiveController
{
public $modelClass = 'common\models\Models';
public function behaviors()
{
$behaviors = parent::behaviors();
// $behaviors['authenticator'] = [
// 'class' => QueryParamAuth::className(),
// ];
return $behaviors;
}
public function actionIndex()
{
return new ActiveDataProvider([
'pageSizeLimit' => [0, 50],
]);
}
}
does not work
I saw it, but did not understand where I have to write these lines?)
<?php
namespace rest\versions\v1\controllers;
use yii\data\ActiveDataProvider;
use yii\filters\auth\QueryParamAuth;
use yii\rest\ActiveController;
class ModelsController extends ActiveController
{
public $modelClass = 'common\models\Models';
public function behaviors()
{
$behaviors = parent::behaviors();
return $behaviors;
}
public function actionIndex()
{
return new ActiveDataProvider([
'pageSizeLimit' => [0, 50],
]);
}
}
does not work
See API ActiveDataProvider and his pagination. After see property of Pagination.
public function actionIndex()
{
return new ActiveDataProvider([
'pagination' => [
'defaultPageSize' => 20 // to set default count items on one page
'pageSize' => 25 //to set count items on one page, if not set will be set from defaultPageSize
'pageSizeLimit' => [1, 50], //to set range for pageSize
],
]);
}
To disable pagination:
public function actionIndex()
{
return new ActiveDataProvider([
'pagination' => false,
]);
}
Hello! Default limit 20, I set limit ?page=1&per-page=50 but 50 is max value where i can disable pagination?