Hello fellow Yii’ers.
Without any clear reason I’m experiencing that a particular admin page is showing only half of what I set as PageSize.
If the PageSize is set to 10 it shows 4 of 10 (Displaying 1-4 of 10 results)
If set to 20 it shows 10.
Here is the code from Search()
public function search() {
$criteria = new CDbCriteria;
$criteria->with = [
'institution' => [
'alias' => 'institution',
],
'user' => [
'alias' => 'user',
'with' => [
'profile' => [
'alias' => 'profile',
],
],
],
'employeeType' => [
'alias' => 'employeeType'
],
'employeeTitle' => [
'alias' => 'employeeTitle'
],
'departmentEmployees' => [
'alias' => 'departmentEmployees',
'together' => TRUE,
'with' => [
'department' => [
'alias' => 'department',
]
]
],
];
$criteria->addCondition('t.institution_id', $this->currentUserInfo['employee']['institution_id']);
$criteria->addSearchCondition('t.institution.name', $this->institution_id);
$criteria->addSearchCondition('concat(profile.firstname, " ", profile.lastname)', $this->id);
$criteria->addSearchCondition('department.name', $this->department_name);
$criteria->addSearchCondition('alias', $this->alias);
return new CActiveDataProvider($this, [
'criteria' => $criteria,
'sort' => [
'defaultOrder' => 'concat(profile.firstname, " ", profile.lastname) asc',
'attributes' => [
'id' => [
'asc' => 'concat(profile.firstname, " ", profile.lastname)',
'desc' => 'concat(profile.firstname, " ", profile.lastname) desc',
],
'department_name' => [
'asc' => 'department.name',
'desc' => 'department.name desc',
],
//'*',
],
],
'pagination' => [
'PageSize' => 10,
],
]);
}
Here is the Admin part
$this->widget('bootstrap.widgets.TbGridView', [
'id' => 'employee-grid',
'dataProvider' => $model->search(),
'filter' => $model,
'columns' => [
[
'name' => 'id',
'type' => 'raw',
'value' => function($data) {
return CHtml::tag('strong', [], $data->getFullname()) . $data->ibgFolder->coverImageLink;
},
],
[
'name' => 'department_name',
'type' => 'raw',
'value' => function($data) {
return $data->getDepartmentsList();
}
],
[
'class' => 'bootstrap.widgets.TbButtonColumn',
],
],
]);
Any suggestion is appreciated.
Many thanks in advance