cancel
Showing results for 
Search instead for 
Did you mean: 

Send some parameters using Button component

Send some parameters using Button component

How can I send some parameters (Data) in DataProvider using the button

Here action_update_modal is my Modal component and update_action_form_loader is my insertForm

In the documentation, it is mentioned that we can use params to send data to the provider's method https://devdocs.magento.com/guides/v2.4/ui_comp_guide/components/ui-button.html

So I tried this .. but nothing works.

Please Advice.

<item name="2" xsi:type="array">
      <item name="targetName" xsi:type="string">
          ${ $.parentName}.action_update_modal.update_action_form_loader
      </item>
      <item name="actionName" xsi:type="string">render</item>
      <item name="params" xsi:type="array">
           <item name="myparam" xsi:type="string">My Value</item>
      </item>
 </item>

Here is my complete source code.

<button name="new_action_button">
<argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
        <item name="formElement" xsi:type="string">container</item>
        <item name="buttonClasses" xsi:type="string">add-new-action-button</item>
        <item name="actions" xsi:type="array">
            <item name="0" xsi:type="array">
                <item name="targetName" xsi:type="string">
                    ${ $.parentName}.action_update_modal.update_action_form_loader
                </item>
                <item name="actionName" xsi:type="string">destroyInserted</item>
            </item>
            <item name="1" xsi:type="array">
                <item name="targetName" xsi:type="string">${ $.parentName}.action_update_modal</item>
                <item name="actionName" xsi:type="string">openModal</item>
            </item>
            <item name="2" xsi:type="array">
                <item name="targetName" xsi:type="string">
                    ${ $.parentName}.action_update_modal.update_action_form_loader
                </item>
                <item name="actionName" xsi:type="string">render</item>
            </item>
        </item>
    </item>
</argument>
<settings>
    <title translate="true">Add New Action</title>
</settings>
</button>
<modal name="action_update_modal">
<settings>
    <options>
        <option name="title" xsi:type="string" translate="true">Add/Update Action</option>
    </options>
URL