hello everybody
first, sorry for my English is not very good, in my project, I have to generate an output to excel from data from a Gridview, I have done by request, the excel sheet is simple, in the model inside search function I have done if the user filters the data
$session=new CHttpSession;
$session->open();
$session['TbPersonasServicios_records']=$criteria;
in the controller i have do this
public function actionGenerarExcel()
{
$session=new CHttpSession;
$session->open();
if(isset($session['TbPersonasServicios_records'])) // with data filter by user
{
$model=TbPersonasServicios::model()->findAll($session['TbPersonasServicios_records']);
$content=$this->renderPartial("excelReport",array ("model"=>$model),true);
yii::app()->request->sendFile("ExcelPersonasServicios.xls",$content);
}
else //there isn't data filter by the user
{
$model=TbPersonasServicios::model()->findAll();
}
$model=TbPersonasServicios::model()->findAll();
$content=$this->renderPartial("excelReport",array ("model"=>$model),true);
yii::app()->request->sendFile("ExcelPersonasServicios.xls",$content);
}
in the action rules, i have enable the function "GenerarExcel"
public function accessRules()
{
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions'=>array('index','view','BuscaPersonas','PasaPersonas','DesdeEntidad','GenerarExcel','GenerarPdf'),
'users'=>array('*'),
in the corresponding view, I have the file excelReport.php in the tbPersonasServicios view and i have in the menu one option to execute the report.
array('label'=>'Excel', 'url'=>array('GenerarExcel')),
ok, when i try to execute de report, the system show me this error.
ERR_INVALID_RESPONSE
http://localhost/.../index.php?r=TbPersonasServicios/GenerarExcel
the system don`t find the action “GenerarExcel”. and i don’t know why, because i have the same process to generate a pdf report in the same controller and it is working correctly.
thanks for your time.