0

I have modal configured in my listing page xml as below

<listing>
    ....
    <modal name="dispatch_email_modal">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="onCancel" xsi:type="string">actionCancel</item>
                <item name="options" xsi:type="array">
                    <item name="buttons" xsi:type="array">
                        <item name="0" xsi:type="array">
                            <item name="text" xsi:type="string">Cancel</item>
                            <item name="class" xsi:type="string">action-secondary</item>
                            <item name="actions" xsi:type="array">
                                <item name="0" xsi:type="string">actionCancel</item>
                            </item>
                        </item>
                        <item name="1" xsi:type="array">
                            <item name="text" xsi:type="string">Send Email</item>
                            <item name="class" xsi:type="string">action-primary</item>
                            <item name="actions" xsi:type="array">
                                <item name="0" xsi:type="string">actionDone</item>
                            </item>
                        </item>
                    </item>
                </item>
            </item>
        </argument>
        <field name="RecipientName">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="label" xsi:type="string">Recipient Name</item>
                    <item name="formElement" xsi:type="string">input</item>
                    <item name="visible" xsi:type="boolean">true</item>
                </item>
            </argument>
        </field>
    </modal>
    ....
</listing>

In my javascript, I am planning to trigger this one from a method which I bind it on custom button. When I clicked the button, the method createModal is called with no issue because the console.log(this.dispatchModal) is called. However the next line, I am not sure how to trigger the modal from the xml.

...
return Actions.extend({
    defaults: {
        bodyTmpl: "VendorWhatever_Warehouse/grid/columns/dispatch-date",
        dispatchModal : '${ $.parentName }.dispatch_email_modal'
    },

    initialize: function() {
        this._super();

        return this;
    },

    createModal: function(){
        console.log(this.dispatchModal);
        this.dispatchModal.openModal();
    }
});
...

Thanks a lot in advance

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.