Yii Cgridview export csv using extension

I’ve implemented the wrapper extension for for eexcelview here:http://www.yiiframework.com/extension/toexcel/ to export my cgridview data. However, at this very time, I can only figure out how to export all the records for an entire model.

This is my action in the model’s controller

public function actionExcel()


    // Load data (scoped)

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

	$fileName = 'Packaging_Metric_Data_Export_'. date("m-d-y");



        // Export it















            'creator' => 'Data Access Portal',





The comments on the page for the extension explain to use a method similar to this to achieve this feature. However, I cannot seem to get this to work.

$model = YourModel('search'); 

$model->type = 1; // This will filter out all the results whose type is 1 

$dataProvider = $model->search(); 

Could anyone clarify how to retrieve the filtered cgridview results to be exported by the extension?

if I set

 $model= $model->search() 

I only get the default first page of records from cgridview exported to the csv





I know this is late, but I stumbled across this in trying to find a solution, so I’m sure someone else will