Yii2 Kartik extension file not found

I am new to Yii, and I have installed the Kartik export extension. When I click on export in any format, I get the following error:

File not found

Firefox cannot find the file at http: //localhost/basic/web/index.php? R = industrial / index & page = 1 .

Check the file name for capitalization or other input errors. Check to see if the file has been moved, renamed or deleted.

When I run the specified path, the page opens normally. Did I miss something?

Please check my code:

IndustrialController.php:

<?php 

namespace app\controllers; 
use yii\web\Controller; 
use yii\data\Pagination; 
use app\models\industrial; 
use yii\data\ActiveDataProvider; class IndustrialController extends Controller {

public function actionIndex()
{
      $query = industrial::find();
    $pagination = new Pagination([
        'defaultPageSize' => 20,
        'totalCount' => $query->count(),
    ]);

    $industrials = $query->orderBy('Company_Name')
        ->offset($pagination->offset)
        ->limit($pagination->limit)
        ->all();


     $dataProvider=new ActiveDataProvider([
        'query' => industrial::find(),
'pagination'=>['pageSize'=>20],
    ]);

    //return $this->render('index', ['dataProvider'=>$dataProvider]);
             return $this->render('index', [
        'dataProvider'=>$dataProvider,
        'industrials' => $industrials,
        'pagination' => $pagination,
    ]);
}
}

Views / Industrial / index.php:

 <?php 


use yii\helpers\Html; 
use kartik\export\ExportMenu; 
use kartik\grid\GridView; 
use yii\widgets\LinkPager; 

$gridColumns = [ ['class' => 'yii\grid\SerialColumn'],

'Company_Name',
'Category',
'Phone',
'EMail',
];
?>



<?= ExportMenu::widget([
'dataProvider' => $dataProvider,
'columns' => $gridColumns,
'fontAwesome' => true,
'dropdownOptions' => [
'label' => 'Export All',
'class' => 'btn btn-default'
]
]) ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => $gridColumns,
'export' => [
'fontAwesome' => true,
]
]); ?>

What action do you need to add to the controller to download the extracted file?

+4

All Articles