CListview/CGridview pager broken when using group

When I apply a group to a query result, like this:

$criteria->group = 't.post_id';

$dataProvider = new CActiveDataProvider('Users', array('criteria' => $criteria));

The pager seems unaware of the group operation and shows the total (ungrouped) rows ("Displaying 1-10 of 11509 result(s)") while there are only about 300 (grouped) rows. The amount of items that are displayed however, is correct. So the pager thinks there are hundreds of pages, but after page 22 it shows "No results found.".

I’m using several relations, but only HAS_ONE and BELONGS_TO

Is this a known issue, and are there any workarounds?

You could try to set the totalItemCount property as a workaround.

Thanks! I’ll try it