ExportableGridBehavior - tinyurl.com/expgrid
This works fantastically with usual dataproviders. But when using with CArrayDataProvider it is causing issues, and giving blank data in the CSV. Is it possible to use this extension with a CArrayDataProvider. What should my syntax in the Controller look like?
Model Code: searchProfitCurrency method
$rawData=Yii::app()->db->createCommand($selectStatment)->queryAll();
return new CArrayDataProvider($rawData, array(
'id'=>'id',
'sort'=>array(
'attributes'=>array(
'Currency',
'profitMarginCurrency'
),
),
'pagination'=>array(
'pageSize'=>50,
),
));
Controller Code:
$search_dataProvider = $model->searchProfitCurrency();
$this->exportCSV($search_dataProvider,
array(
$search_dataProvider['Currency'],
$search_dataProvider['profitMarginCurrency'],
));