-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How i can change limit in output? #15
Labels
Comments
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,
]);
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello!
Default limit 20,
I set limit ?page=1&per-page=50
but 50 is max value
where i can disable pagination?
The text was updated successfully, but these errors were encountered: