0

I wish to add import button in my custom admin grid using ui component, in magento 2.

To add this import button which type of grid is better ? ui component grid or php grid.

Note :

We can fill the grid by clicking add new and fill the form or by clicking import button and upload csv file

Please provide me a solution

1 Answer 1

1

ui_component is easier..

 <fieldset name="Import">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="collapsible" xsi:type="boolean">false</item>
            <item name="label" xsi:type="string" translate="true">Import</item>
        </item>
    </argument>
    <field name="import">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="label" xsi:type="string">Import</item>
                <item name="visible" xsi:type="boolean">true</item>
                <item name="formElement" xsi:type="string">fileUploader</item>
                <item name="uploaderConfig" xsi:type="array">
                    <item name="url" xsi:type="url" path="path/to/controller"/>
                </item>
            </item>
        </argument>
    </field>
</fieldset>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.