This is my dataProvider it is joining multiple tables. The original listing table has a BookId which belongs to the books table. And each book has multiple authors and multiple categories.
Dataprovider :
$dataProvider=new CActiveDataProvider('Listing', array(
'criteria'=>array(
'with'=>array('book.authors','user','book.bookCategories'),
'together'=>true
),
'sort'=>array(
'attributes'=>array(
'author_search'=>array(
'asc'=>'authors.name',
'desc'=>'authors.name DESC'
),
'*'
)
),
'pagination'=>array(
'pageSize'=>5
),
));
And in my view I have :
$this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'itemView'=>'_cards',
'template'=>"{summary}\n{pager}\n{sorter}\n{items}", // refers to the partial view named '_post'
'enableSorting'=>true,
'sortableAttributes'=>array(
'name',
'author_search'
),
));
Now the pagination is not working. Currently I have 6 books in the table. I have attached the screen shot below. The pager doesn’t appear and I am not able to see all the books but when I increase the pageSize to say 100 all the books are visible.
I’d really appreciate if somebody could help me out.
Edit 1:
Ok when I remove the together property from the criteria it is working fine but sorting breaks as I am sorting by authors name. Any ideas ?