Eexcelview - Export Search Result Grom Tbgridview

Hello. I’ve a little problem with EExcelView.

I added eexcelview and phpmyexcel to my app.ext. Then i created additional action in my controller:

        public function actionEksport()


            // Load data

            $model = Obs::model()->findAll();

            // Export it








            'creator' => 'admin',


        'Excel2007' // This is the default value, so you can omit it. You can export to CSV, PDF or HTML too



Everythings works fine, data are exported when i click button in my view, which called action controller/eksport. But i want to export data, which are only displayed on screen (for example, search result from "advanced search" etc…)

Can anyone help me?

Many thanks



always will be load all data (without params).

For example if you use "default advanced search" you can do it so:

$model=new Obs('search');





Unfortunatelly it doesn’t work well. When i pasted your code, it return data, which have not nothing similiar to my search result:(

What does the function toExcel look like?

This is one way I’ve implement it before.

public function actionSalesReport()


	$startDate = $_GET['Order']['reportStartDate'];

	$endDate = $_GET['Order']['reportEndDate'];

	$criteria = new CDbCriteria();

	$criteria->condition = 'state=:orderState';

	$criteria->params = array(

		':orderState' => Order::STATE_COMPLETED


	$criteria->addBetweenCondition('requested_shipping_date', '' . $startDate . '', '' . $endDate . ' 23:59:59 ');

	$dataProvider = new CActiveDataProvider('Order', array(

			'criteria' => $criteria


	$this->widget('ext.phpexcel.EExcelView', array(

		'dataProvider' => $dataProvider,

		'grid_mode' => 'export',

		'columns' => array(








				'type' => 'raw',

				'header' => 'Shipping Address',

				'value' => 'Yii::app()->controller->widget("ext.BNDComponents.widgets.BNDAddressWidget.BNDAddressWidget", array(

					"address" => ($data->is_delivery) ? $data->shippingAddress : $data->pickupArea,

					"format" => BNDAddressWidget::FORMAT_MAPPABLE

				), true)'













I’m using this extensions: . This extensions compile eexcelview and phpexcel

I think that problem is, that when i search and filter data i have for example url like this:[col1]=sth&Obs[col2]=other&Obs_page=1

, and when i try to execute my export action, url look like: - and it export data without parameters - simply, actionEksport don’t know criteria…

So your $_GET/$_POST environment variables are empty? This thread shows how to serialize the form and post it to your export action.

Ok, thanks for reply:)