Download the PHP package eseperio/yii2-exportable-gridview without Composer
On this page you can find all versions of the php package eseperio/yii2-exportable-gridview. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eseperio/yii2-exportable-gridview
More information about eseperio/yii2-exportable-gridview
Files in eseperio/yii2-exportable-gridview
Package yii2-exportable-gridview
Short Description Yii2 gridview with full export of data to spreadsheet.
License MIT
Informations about the package yii2-exportable-gridview
yii2 Exportable Gridview
Gridview with full data export
This works as normal gridview, but adds a button to export the data loaded into it. It exports all records found on the active record query. Works with the same data as the gridview does. Uses phpspreadsheet to generate export file.
How does it work
Following the same behavior that pjax widget, this widget act as a normal gridview until
a request is made with the url query parameters export-grid
and export-container
.
The latter should contain the id of gridview without the hashtag. When both parameters are received, response
is cleared and then spreadsheet generation begins. This allow to generate a file with absolutely all
records found on the gridview.
This project is currently under development. Any contribution is welcome.
Installation
Usage
This widget extends from yii2-gridview but add functionality to export all the rows queried by the DataProvider.
Additional configuration
Name | Type | default | Description |
---|---|---|---|
layout |
string | {summary} {items} {export} {pager} | In addition to default layout this gridview has {export } section. This is the place for export button. |
fileName |
string | exported.xls | Name to use on the generated filename. If writerType value is not set then the writer will be guessed from the extension. |
writerType |
string | null | The writer to be used when generating file. See Spreadsheet writer. Accepts Xls, Xlsx, Ods, Csv, Html, Tcpdf, Dompdf, Mpdf |
exportable |
boolean | true | Whether to enable export for this gridview |
exportLinkOptions |
array | ['class'=> 'btn btn-default', 'target'=>'_blank'] |
Options for the export link. It also accepts label and encode |
exportColumns |
array | empty | Property to define a different column combination for export only. If empty default columns of gridview will be used |
Constants available
All writers identifiers are available through constants.
Constant name | Value |
---|---|
WRITER_XLS |
Xls |
WRITER_XLSX |
Xlsx |
WRITER_ODS |
Ods |
WRITER_CSV |
Csv |
WRITER_HTML |
Html |
WRITER_TCPDF |
Tcpdf |
WRITER_DOMPDF |
Dompdf |
WRITER_MPDF |
Mpdf |
Notes
All html tags are removed when exporting.
Todo
- [ ] Add option to exclude certain columns like ActionColumn.
- [ ] Add batch data processing.
- [ ] Add custom PDF export method.
- [ ] Add tests