当前位置: 首页>>代码示例>>PHP>>正文


PHP ActiveDataProvider::setPagination方法代码示例

本文整理汇总了PHP中yii\data\ActiveDataProvider::setPagination方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveDataProvider::setPagination方法的具体用法?PHP ActiveDataProvider::setPagination怎么用?PHP ActiveDataProvider::setPagination使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\data\ActiveDataProvider的用法示例。


在下文中一共展示了ActiveDataProvider::setPagination方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setPagination

 /**
  * Sets the pagination for this data provider.
  * @param array|Pagination|boolean $value the pagination to be used by this data provider.
  * This can be one of the following:
  *
  * - a configuration array for creating the pagination object. The "class" element defaults
  *   to 'yii\data\Pagination'
  * - an instance of [[Pagination]] or its subclass
  * - false, if pagination needs to be disabled.
  *
  * @throws InvalidParamException
  */
 public function setPagination($value)
 {
     if (is_array($value) && !isset($value['pageSizeLimit'])) {
         $value['pageSizeLimit'] = [1, 100];
     }
     parent::setPagination($value);
 }
开发者ID:timelessmemory,项目名称:uhkklp,代码行数:19,代码来源:ActiveDataProvider.php

示例2: actionLeader

 public function actionLeader()
 {
     $dataProvider = Null;
     $searchModel = new OrderSearch();
     $totalbales = 0;
     $query = new Query();
     $dataProvider = new ActivedataProvider(['query' => Order::find(), 'pagination' => ['pageSize' => 20]]);
     $totalProvider = new ActiveDataProvider(['query' => Order::find()]);
     $totalProvider->setPagination(False);
     $models = $totalProvider->getModels();
     foreach ($models as $item) {
         $totalbales += $item->number_bales;
     }
     return $this->render('leader', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'totalbales' => $totalbales]);
 }
开发者ID:thehern-troop15,项目名称:pinestraw,代码行数:15,代码来源:OrderController.php

示例3: setPagination

 /**
  * @inheritdoc
  */
 public function setPagination($value)
 {
     if (is_array($value)) {
         $config = ['class' => Pagination::className()];
         if ($this->id !== null) {
             $config['pageParam'] = $this->id . '-page';
             $config['pageSizeParam'] = $this->id . '-per-page';
         }
         parent::setPagination(Yii::createObject(array_merge($config, $value)));
     } elseif ($value instanceof Pagination || $value === false) {
         parent::setPagination($value);
     } else {
         throw new InvalidParamException('Only Pagination instance, configuration array or false is allowed.');
     }
 }
开发者ID:roman444uk,项目名称:yii2,代码行数:18,代码来源:ActiveDataProvider.php

示例4: setPageSize

 /**
  * Sets page size
  * @param \yii\data\ActiveDataProvider $dataProvider
  */
 public static function setPageSize(\yii\data\ActiveDataProvider &$dataProvider, $pageSize)
 {
     $dataProvider->setPagination([$dataProvider->pagination->pageSizeParam => $pageSize]);
 }
开发者ID:dlds,项目名称:yii2-components,代码行数:8,代码来源:DataProviderHelper.php

示例5: actionTestl

 public function actionTestl()
 {
     echo "sss";
     $dataProvider = new ActiveDataProvider(['query' => Appcomments::find()]);
     //$dataProvider->keys;
     //$dataProvider->models;
     /*$dataProvider->setPagination(false);
     		$mymodel=$dataProvider->models;
     		foreach ($mymodel as $model){
     			echo $model['appid'];
     			
     		}*/
     $pagination = $dataProvider->getPagination();
     var_dump($pagination->page);
     $count = 0;
     while ($categories = $dataProvider->models) {
         /*foreach ($categories as $model) {
         			$model['appid']=0;
         		}*/
         //echo $pagination->page=1+$count;
         $count++;
         $dataProvider->setPagination($count);
     }
     //$mymodel[4]['kind']="bbbbbb";
     //$dataProvider->setModels($mymodel);
     //var_dump($dataProvider->models[4]['kind']);
     //echo $dataProvider->models;
 }
开发者ID:jiaweizhou,项目名称:alliance,代码行数:28,代码来源:MessagesController.php

示例6: searchFront

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  * @param integer $category
  * @param null|string $user
  * @return ActiveDataProvider
  * @internal param int $post_type
  */
 public function searchFront($params, $category = null)
 {
     $query = PostModel::find();
     if ($category) {
         $query->join('left join', 'term_relationship', "term_relationship.post_id = post.id");
         $query->andWhere(['term_relationship.term_id' => $category]);
     }
     $query->andWhere(['post.post_type' => 1]);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->setSort(['attributes' => ArrayHelper::merge($dataProvider->sort->attributes, ['username' => ['asc' => ['username' => SORT_ASC], 'desc' => ['username' => SORT_DESC], 'label' => 'Author', 'value' => 'username']]), 'defaultOrder' => ['post_date' => SORT_DESC]]);
     $dataProvider->setPagination(['pageSize' => 2]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     return $dataProvider;
 }
开发者ID:fbarrento,项目名称:yii2-content,代码行数:28,代码来源:Post.php


注:本文中的yii\data\ActiveDataProvider::setPagination方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。