ExportButton component
Overview
The ExportButton component implements the ability to export grid data to the specified data format (cvs, xml, and so on).
Structure
Constructor: app/code/Magento/Ui/view/base/web/js/grid/export.js
ExportButton configuration
Extends all UiElement configuration.
ExportButton-specific configuration:
Option | Description | Type | Default |
---|---|---|---|
additionalParams |
List of additional parameters added to each performed request. | { [name: string]: string } |
- |
options |
List of available formats in which the table's data can be exported. | Array<ExportOption > |
[{ |
template |
Path to the component’s .html template. |
String | ui/grid/exportButton |
ExportOption
interface
Option | Description | Type | Required |
---|---|---|---|
label |
Option's label. | String | Required |
url |
Path to controller that will process the request. | String | Required |
value |
Identifier of the export option. | String | Required |
How to use
To enable the ExportButton сomponent, add the exportButton
element with a selectProvider
item to the listing configuration file.
Example
Example: <Magento_Sales_module_dir>/view/adminhtml/ui_component/sales_order_grid.xml
By default Magento allows CSV and Excel XML export data formats.
How to add new export format
To add new export format:
- Add configuration data to ExportButton definition
Magento/Ui/view/base/ui_component/etc/definition.xml
- Add controller for new format processing
\Magento\Ui\Controller\Adminhtml\Export\GridToFoo
- Add converter
\Magento\Ui\Model\Export\ConvertToFoo