I have filtered my data and it shows on a gridview and I want to export them into excel sheets but when I do it , It exporting the whole data
I have filtered my data and it shows on a gridview and I want to export them into excel sheets but when I do it , It exporting the whole data
Some Code would be helpful. Are you using kartik for Export? Please Provide some more Details.
Okay !
The View :
<?= Html::a('<span class="btn btn-info btn-sm glyphicon glyphicon-export"></span>' ,['bo-pipeline/excel' ], ['title' => Yii::t('yii', 'Exporter'),]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'pager' => [
//'class' => \kop\y2sp\ScrollPager::className(),
'firstPageLabel' => 'First',
'lastPageLabel' => 'Last',
],.........etc ?>
The controller :
public function actionExcel()
{
$model = new BoPipeline();
$searchModel = new BoPipelineSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('excel', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
I also have an action that contains the result of the filter which I save it into a BoPipelineSearch object but the problem is that when I want to use that object in other action I don’t know how ! it’s only known on the actionIndex not in the whole controller
can you also show the BoPipeline Controller please? if you want to use an object from another class you have to include the namespace on top of your Controller for example "use \app\models\BoPipelineSearch;"