Krajee

Export Menu Demo

Thankful to Krajee! BUY A COFFEEor to get more out of us.

Demonstration examples for the yii2-export extension. All the examples below need a dataProvider which can be passed like any data provider to a \kartik\grid\GridView.

Tip

Not seeing the updated content on this page! Hard refresh your browser to clean cache for this page (e.g. SHIFT-F5 on Windows Chrome)

Display only the export menu dropdown, without any grid. Note that the column selector is displayed along with the grid by default.
Click for demo
Display export menu dropdown along with a basic kartik\grid\GridView. Set a label for your export menu dropdown.
Click for demo
Control specific export formats to be shown. For example, hide the TEXT, HTML, and EXCEL 95 export formats by setting these to false or null within ExportMenu::exportConfig. In addition, this example also shows how you can configure specific properties for a format. For example, you can control PDF output rendering by setting the pdfConfig setting. The pdfConfig setting within ExportMenu::exportConfig array for the format ExportMenu::FORMAT_PDF, will allow you to configure the settings for the kartik\mpdf\Pdf component.
Click for demo
Easily format cell styles via new column properties available since v1.2.9. The properties exportMenuStyle and/or exportMenuHeaderStyle properties available in kartik\grid\DataColumn and kartik\grid\SerialColumn can be configured as an array. This will be detected and applied by \PhpOffice\PhpSpreadsheet\Style\Style::applyFromArray() for the cells. Note that with v1.2.9, the ExportMenu will intelligently also detect and auto format and style the columns based on the column hAlign, vAlign and format properties to a limited extent. This example also shows how you can have different column configurations for the GridView and ExportMenu.
Click for demo
Allow to set and override explicit cell formats by setting the cellFormat within the column's headerOptions, contentOptions, or footerOptions. You can also set cellFormat for each cell configured within ExportMenu::contentBefore and ExportMenu::contentAfter. The value for cellFormat must be one of the PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_ constants. This setting will override any other autoFormat setting.
Click for demo
Customize your column selector with a custom label. You can choose to hide certain columns from the column selector by setting hiddenColumns (e.g. let's hide the SerialColumn and the ActionColumn). Note that hiddenColumns only control the display of columns in the column selector. Hidden columns will be displayed in the export if they are a part of selectedColumns. We can also disable certain columns in the column selector by setting disabledColumns (e.g. let's disable ID and Author Name). Similar to hiddenColumns, disabled columns will be displayed in the export if they are a part of selectedColumns.
Click for demo
Extension of column selector case 1 to preset your column selections on load (let's say only ID, Name, Author Name, Color, & Publish Date is preselected). Let's add one more column (Color) to the hiddenColumns as well (though hidden from selection, this will still be displayed on export as it is set in selectedColumns). Set noExportColumns to hide from export and the dropdown (e.g. let's not export the Status column). In addition customize the column labels displayed in the column selector (e.g. change Buy Amount and Sell Amount labels).
Click for demo
Set target for export form submission to ExportMenu::TARGET_BLANK. Display export menu dropdown embedded within the toolbar of kartik\grid\GridView as a separate menu. Uses the plugin ability of kartik\grid\GridView. Note, in the example below, the Full Menu from yii2-export is generated along with the inbuilt Page Menu from yii2-grid. In addition, this example includes a pjax enabled grid. You need to set ExportMenu::pjaxContainerId and GridView::pjaxSettings['options']['id'] to the same value.
Click for demo
Variation of advanced case 1. Display export menu dropdown merged along with the dropdown items of the default kartik\grid\GridView export menu. Uses the plugin ability of kartik\grid\GridView. Display your own customized menu list and style it with CSS. Note you will set asDropdown to false in this case. Hence the Columns Selector will not be displayed (you will need to render the exportColumnsView on your own if needed).
Click for demo
Display your own customized menu list and style it with CSS. Note you will set asDropdown to false in this case. Hence the Columns Selector will not be displayed (you will need to render the exportColumnsView on your own if needed).
Click for demo
An example showing multiple export menu widgets on the same page with different data providers. It also shows an use of 2 array data providers. Note you must set unique identifiers options['id'] for each export menu. By default this will be uniquely generated by the yii2-export extension anyway.
Click for demo
An example showing how you can download larger export files without streaming to browser. You need to set stream property to false. This way the exported data will be directly written to a file instead of streaming to buffer. The exported file will be then displayed as a web accessible link for download. You may see some improvement by avoiding memory issues due to output buffering, and the file is saved directly to a web server folder. You can provide the folder and linkPath properties to set the folder for saving and the web accessible link location for the saved file respectively. The extension will automatically show a link to the saved file based on above settings. You can set the afterSaveView file to point to your own view that displays the generated file link. Note: The target property will automatically be overridden to ExportMenu::TARGET_SELF or _self when this is set.
Click for demo
A variation of large files linking scenario where you can control the linkPath and move internally the generated file from the temporary folder to your target link location. You can use and setup the onGenerateFile Closure callback to manage this movement. It also configures the deleteAfterSave property to true to automatically delete the saved files on the server folder after its been linked via the linkPath.
Click for demo
Scenario for batch loading of models. You can set the batchSize property to fetch models in batches of this size from the dataProvider. This will improve the memory usage by not loading all the models into memory. The exported output will still be a single file containing all data, but it will be rendered with models selected in a batch mode to generate output rows. Each batch will read batchSize number of models at a time, and once processed the next batch of models will be retrieved from the dataProvider.
Click for demo

Note

You can now visit the Krajee Webtips Q & A forum for searching OR asking questions OR helping programmers with answers on these extensions and plugins. For asking a question click here. Select the appropriate question category (i.e. Krajee Plugins) and choose this current page plugin in the question related to field.

The comments and discussion section below are intended for generic discussions or feedback for this plugin. Developers may not be able to search or lookup here specific questions or tips on usage for this plugin.

 
visitors to Krajee Yii2 Demos since 22-May-2017