Exporting Cgridview Results To Csv File

Hi,

Can anybody tell me how to create a csv file from CGridview?

i can try this but it’s single db record fetch http://www.yiiframework.com/wiki/306/exporting-cgridview-results-to-csv-file/

Note:my grid view is multiple table relational so how can this possible

Please help it’s Urgent

Best Regards,

Ankit Modi

Have you tried to use EExcelView extension? IMHO, it would be easier and more flexible to use as you can set it up like CGridView:




$this->widget('application.extensions.EExcelView', array(				

   'dataProvider'=>$data,

   'autoWidth'=>true,

   'exportType'=>'CSV',

   'filename'=>'...',

   'columns'=>array(

       'id', 

       array(

          'name'=>'projectName',		

          'value'=>'$data->project->name'       // relational field                

       ),

       'description'

   )

));



Thanks, I already have it working.

Best Regards,

Ankit Modi

Hii…

i try it,and i just see view all of data in CGridView,

how i can save it to format csv? or if i success, how i can see the result file…i have name it "reportTrx"

please explain more, thanks