I have bootstrap modal with gridview in it. Pagination for dataProvider is set to 5. The problem is that I have only 1 row on the first page of my gridview, other pages seems to work good. Here's gridview code
<?php Pjax::begin(); ?>
<?= GridView::widget([
'dataProvider' => $operations,
'filterModel'=>$fModel,
'columns' => [
'operation_code',
'amount',
[
'attribute'=>'type',
'content'=>function($model){
return ClientMoneyOperation::itemAlias('type_color',$model->type);
},
'filter'=>ClientMoneyOperation::itemAlias('type'),
],
[
'header'=>'Бонус',
'content'=>function($model){
return $model->bonus->amount;
}
],
[
'header'=>'Директорський бонус',
'content'=>function($model){
return $model->directorbonus;
}
],
'comment',
[
'attribute'=>'created_at',
'format'=>'datetime',
'filter'=>false],
]
]) ?>
<?php Pjax::end(); ?>
and search function
public function
search($params,$city_id=null,$client_id=null,$page_size=20,$group =
false,$code=null,$date_from = null){
if($city_id){
$query = ClientMoneyOperation::find()->joinWith(['user.place'])-
>where(['place.city_id'=>$city_id]);
} else {
$query = ClientMoneyOperation::find();
}
$query->joinWith(['client'])->joinWith(['bonus']);
if($group){
$query->groupBy('operation_code');
}
$query->orderBy('created_at DESC');
if($code){
$query->where(['operation_code'=>$code]);
}
$dataProvider = new ActiveDataProvider([
'query'=>$query,
'sort'=>['attributes'=>['created_at'=>SORT_DESC]],
'pagination'=>[
'pageSize'=>$page_size
],
]);
$this->load($params);
if(!$this->validate()){
return $dataProvider;
}
$query->andFilterWhere([
'client_money_operation.type'=>$this->type,
'client_money_operation.status'=>$this->status,
]);
if($client_id){
$query->andFilterWhere([
'client_money_operation.client_id'=>$client_id,
]);
}
$query->andFilterWhere(['like','client_money_operation.comment',$this->comment])
->andFilterWhere(['like','client.card_code',$this->card_code])
->andFilterWhere(['like','client_bonus_operation.amount',$this->bonus_amount])
->andFilterWhere(['like','client_money_operation.operation_code',$this->operation_code]);
if(!empty($this->created_at_range) && strpos($this->created_at_range, '-') !== false){
list($start_date, $end_date) = explode(' - ', $this->created_at_range);
$query->andFilterWhere(['between', 'client_money_operation.created_at', strtotime(date("Y-m-d",strtotime($start_date))), strtotime(date("Y-m-d",strtotime($end_date)+86400))]);
} else {
$query->andFilterWhere(['between', 'client_money_operation.created_at', $date_from != null ? 1 : strtotime(date("Y-m-d",time())), strtotime(date("Y-m-d",time() + 86400))]);
}
return $dataProvider;
}
other gridviews works ok with the same dataprovider. PageSize 5 is setted in controller, where I am calling function search()