I am trying to export cgridview data (current search results) to a CSV by using the excelview extension, by clicking a button.
However, I am not getting the filtered data in my CSV; instead, I’m getting all the records in the model.
This is my controller action I am calling:
]public function actionExcel()
{
$model = new PackagingMetric('search');
$this->widget('application.extensions.EExcelView', array(
'dataProvider'=> $model->search(),
'grid_mode'=>'export',
'filter'=>$model,
'exportType'=>'Excel5',
'filename'=>'report_work',
));
}[/
I’ve been told I need to retrieve my POST search attributes as follows, but I just receive a "Undefined Index: PackagingMetric " error with the following:
public function actionExcel()
{
$model = new PackagingMetric('search');
//$model->attributes = $_POST['PackagingMetric'];
$this->widget('application.extensions.EExcelView', array(
'dataProvider'=> $model->search(),
'grid_mode'=>'export',
'filter'=>$model,
'exportType'=>'Excel5',
'filename'=>'report_work',
));
}
Anybody have any ideas?