I built a custom function in my model and return the raw data:
function(){
...
$connection=Yii::app()->db;
$command=$connection->createCommand($sql);
$rows=$command->queryAll();
return $rows;
}
$campModel = $model->function..
I then use those rows in CArrayDataProvider:
$dataProvider=new CArrayDataProvider($campModel);
Finally i'm trying to view using CGrid:
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'bo-campaigns-grid',
'dataProvider'=>$campModel,...
I'm guessing this has to do with the way CGrid is paging...but i'm lost Thanks for the help :)
try this,
You could also look at CSqlDataProvider. Not sure if it would give you the SQL flexibility you need, but it should handle sorting for you more easily than CArrayDataProvider
Create a new CSort and CPagination objects and assign them to your dataprovider, because CArrayDataProvider doesn't have them defined. Here is an example of CSort creation: