I am doing a CActiveDataProvider with criteria as follows:
$criteria->select = array('COUNT(id) as CNT', 'SUM(quantity) as QTY'); $criteria->group = 'id';
Now this vastly reduces the number of rows because the table is now only unique items grouped together, and it shows the total number of QTY.
My problems are as follows:
The CGridView doesn’t “know” that there are not as many rows anymore. E.g. at the top it says “Displaying 1 to 25 of 21232 items.” even though by grouping the items there are now only about 1000 items. Also, the page numbers at the bottom allow me to keep clicking until the end as if the table had 21232 items.
When sorting the CGridView by clicking the column headers they are not sorted according to QTY. I assume it’s being sorted by some random
Any insight or help would be greatly appreciated.