A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.) using the PHPExcel library. The widget allows you to configure the dataProvider, columns just like a yii\grid\GridView. However, it just displays the export actions in form of a ButtonDropdown menu, for embedding into any of your GridView or other components.
You can see detailed documentation and demonstration on usage of the extension.
NOTE: The latest version of the extension is v1.0.0 released on 17-Dec-2014. Refer the CHANGE LOG for details.
The preferred way to install this extension is through composer.
Note: Read this web tip /wiki on setting the
minimum-stability
settings for your application's composer.json.
Either run
$ php composer.phar require kartik-v/yii2-export "dev-master"
or add
"kartik-v/yii2-export": "dev-master"
to the require
section of your composer.json
file.
use kartik\export\ExportMenu;
$gridColumns = [
['class' => 'yii\grid\SerialColumn'],
'id',
'name',
'color',
'publish_date',
'status',
['class' => 'yii\grid\ActionColumn'],
];
// Renders a export dropdown menu
echo ExportMenu::widget([
'dataProvider' => $dataProvider,
'columns' => $gridColumns
]);
// You can choose to render your own GridView separately
echo \kartik\grid\GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => $gridColumns
]);
yii2-export is released under the BSD 3-Clause License. See the bundled LICENSE.md
for details.