cancel
Showing results for 
Search instead for 
Did you mean: 

How to make import data button in admin grid with Ui Component ?

How to make import data button in admin grid with Ui Component ?

I have an admin grid with custom content but i do not khow how to make the custom button that can import data into my db_schema table. Can anybody know how to make it and suggest me some way or code. I am very appreciate it.

2 REPLIES 2

Re: How to make import data button in admin grid with Ui Component ?

Hello @annq3sivn4281 

 

Please try below code using ui_component:

 <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>

It may help you!
Thank you

Problem solved? Click Accept as Solution!

Re: How to make import data button in admin grid with Ui Component ?

How about the controller file, what should i do when user click the import data button, it will redirect to the admin form page, furthermore user can browser their computer in order to select the file they want to import