A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.) using the PhpSpreadsheet 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.
In addition, with release v1.2.0, the extension also displays a handy grid columns selector for controlling the columns for export. The features available with the column selector are:
container
property allows you to group the export menu and column selector dropdowns.template
property for manipulating the display of menu, column selector or additional buttons in button group.columnSelectorOptions
columnSelector
property settings.selectedColumns
(you must set the selected column keys)disabledColumns
(you must set the disabled column keys)hiddenColumns
(you must set the hidden column keys)noExportColumns
(you must set the no export column keys)showColumnSelector
propertyasDropdown
is set to true
.The extension offers configurable user interfaces for advanced cases using view templates.
exportColumnsView
allows you to setup your own custom view file for rendering the column selector dropdown.afterSaveView
allows you to setup your own after save view file if you are configuring to save exported file on server.You can see detailed documentation and demonstration on usage of the extension.
NOTE: Refer the CHANGE LOG for details on changes to various releases.
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.
Install the necessary pre-requisite (Krajee Dropdown Extension) based on your bootstrap version:
kartik-v/yii2-bootstrap5-dropdown
kartik-v/yii2-bootstrap4-dropdown
kartik-v/yii2-dropdown-x
For example if you are using the Bootstrap v5.x add the following to the require
section of your composer.json
file:
"kartik-v/yii2-bootstrap5-dropdown": "@dev"
Either run:
$ php composer.phar require kartik-v/yii2-export "@dev"
or add
"kartik-v/yii2-export": "@dev"
to the require
section of your composer.json
file.
Note: you must run
composer update
to have the latest stable dependencies likekartik-v/yii2-krajee-base
The yii2-export
extension is dependent on yii2-grid
extension module. In order to start using yii2-export
, you need to ensure setup of the gridview
module in your application modules configuration file. For example:
'modules' => [
'gridview' => [
'class' => 'kartik\grid\Module',
// other module settings
]
]
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,
'clearBuffers' => true, //optional
]);
// You can choose to render your own GridView separately
echo \kartik\grid\GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => $gridColumns
]);
This project exists thanks to all the people who contribute. [Contribute].
Become a financial contributor and help us sustain our community. [Contribute]
Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]
yii2-export is released under the BSD-3-Clause License. See the bundled LICENSE.md
for details.
yii2-export
Date: 25-Jul-2023
generateRow
.generateRow
.post()
Date: 03-Nov-2021
stripHtml
.Date: 27-Jul-2020
Date: 25-May-2019
Date: 19-Dec-2018
asDropdown
is false
.PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_
constants.
This can be set via cellFormat
settings at one or more of the following levels.
Column::headerOptions['cellFormat']
within columns
array items.Column::contentOptions['cellFormat']
within columns
array items.Column::footerOptions['cellFormat']
within columns
array items.cellFormat
setting for each array item within ExportMenu::contentBefore
cellFormat
setting for each array item within ExportMenu::contentAfter
yii2-export
.Date: 29-Nov-2018
showColumnSelector
is false
.Date: 10-Nov-2018
yii\db\QueryInterface
.Date: 13-Oct-2018
ExportWriterPdf
to allow custom formattingDate: 13-Oct-2018
Date: 12-Oct-2018
ExportWriterPdf
._columnSelectorEnabled
.Date: 11-Oct-2018
Date: 04-Oct-2018
Date: 24-Sep-2018
enableAutoFormat
to control autoformatting excel based on grid format.Date: 07-Sep-2018
src
directory.exportFormHiddenInputs
for submitting additional data with export form.Date: 24-Feb-2018
stripHtml
that would strip Html tags.@webroot/runtime/export
to @app/runtime/export
.Date: 19-Nov-2017
onGenerateFile
.getExportType
to access through onRender
callbacks. styleOptions
parsing for contentBefore
and contentAfter
. isset
.Date: 13-Mar-2017
Date: 05-Aug-2016
batchSize
is set.Date: 18-Apr-2016
pdfLibrary
setting for mPDF.Date: 04-Feb-2016
dev-master
updates.setPHPExcel
, setPHPExcelWriter
, setPHPExcelSheet
onInitExcel
as an event for initPHPExcel
method.Date: 19-Jul-2015
asDropdown
is false
. Fixes #73.stream
to false
and streamAfterSave
to true
.pjaxContainerId
property added to widget to enable refreshing via pjax.clearBuffers
property for better fix of #40.Date: 14-Feb-2015
initProvider
to clear previously fetched models before render.Date: 20-Jan-2015
Date: 12-Jan-2015
columnBatchToggleSettings
to configure column toggle all checkbox.AssetBundle
for export columns selector.exportFormView
allows you to setup your own custom view file for rendering the export form.exportColumnsView
allows you to setup your own custom view file for rendering the column selector dropdown.container
property allows you to group the export menu and column selector dropdowns.columnSelectorOptions
columnSelector
property settings.selectedColumns
(you must set the selected column keys)disabledColumns
(you must set the disabled column keys)hiddenColumns
(you must set the hidden column keys)noExportColumns
(you must set the no export column keys)showColumnSelector
propertyasDropdown
is set to true
.Date: 26-Dec-2014
enableFormatter
to enable/disable yii grid formatter.ActiveDataProvider
and ActiveQueryInterface
.showConfirmAlert
that controls display of the javascript confirmation dialog before download.Date: 17-Dec-2014
Comments