Magento 2.1.18 is the final 2.1.x release. After June 2019, Magento 2.1.x will no longer receive security patches, quality fixes, or documentation updates.
To maintain your site's performance, security, and PCI compliance, upgrade to the latest version of Magento.

ExportButton component

The ExportButton component implements the ability to export grid data to the specified data format (cvs, xml, and so on).

Configuration options

Option Description Type Default
options List of available formats in which the table's data can be exported. Array<ExportOption> [{
value: "csv",
label: "CSV",
url: "mui/export/gridToCsv"
}, {
value: "xml",
label: "Excel XML",
url: "mui/export/gridToXml"
}]
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

Examples

Configure component

To enable the ExportButton component, add the exportButton element with a selectProvider item to the listing configuration file.

1
2
3
4
5
6
7
<exportButton name="export_button">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="selectProvider" xsi:type="string">{select_provider_path}</item>
        </item>
    </argument>
</exportButton>

Use sales_order_grid.xml

Example: <Magento_Sales_module_dir>/view/adminhtml/ui_component/sales_order_grid.xml

1
2
3
4
5
6
7
8
9
10
11
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <container name="listing_top">
        <exportButton name="export_button">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="selectProvider" xsi:type="string">sales_order_grid.sales_order_grid.sales_order_columns.ids</item>
                </item>
            </argument>
        </exportButton>
    </container>
</listing>

By default Magento allows CSV and Excel XML export data formats.

Add new export format

To add new export format:

Source files

Extends UiElement:

Updated