3
<actionsColumn name="actions" class="Vendor\Module\Ui\Component\Listing\Column\SelectActions">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="indexField" xsi:type="string">id</item>
                </item>
            </argument>
        </actionsColumn>

and my class for dropdown action is

public function prepareDataSource(array $dataSource)
    {
        if (isset($dataSource['data']['items'])) {
            foreach ($dataSource['data']['items'] as & $item) {
                $item[$this->getData('name')] =
                    [
                    'sendmail' => [
                        'href' => $this->urlBuilder->getUrl(
                            self::URL_PATH_MAIL,
                            [
                                'entity_id' => $item['entity_id']
                            ]
                        ),
                        'id' => 'click-me',
                        'label' => __('Send Mail')
                    ],
                    'view' => [
                        'href' => $this->urlBuilder->getUrl(
                            static::URL_PATH_VIEW,
                            [
                                'entity_id' => $item['entity_id']
                            ]
                        ),
                        'label' => __('View'),

                    ],
                    'delete' => [
                        'href' => $this->urlBuilder->getUrl(
                            static::URL_PATH_DELETE,
                            [
                                'entity_id' => $item['entity_id']
                            ]
                        ),
                        'confirm' => [
                            'title' => __('Delete'),
                            'message' => __('Are you sure you want to delete a record')
                        ],
                        'label' => __('Delete'),
                    ]
                    ];
            }
        }

        return $dataSource;
    }

Grid show dropdown action

enter image description here

I want to open a popup modal when click on send Mail. My try is when I use uicomponent

<item name="component" xsi:type="string">Vendor_Module/js/grid/columns/Sendmail</item>

Then action column disappear from grid. My Sendmail.js file code is

require(
    [
        'jquery',
        'Magento_Ui/js/modal/modal'
    ],
    function (
        $,
        modal
    ) {
        var options = {
            type: 'popup',
            title: 'Contact Form',
            buttons: [{
                text: $.mage.__('Close'),
                class: '',
                click: function () {
                    this.closeModal();
                }
            }]
        };

        var popup = modal(options, $('#popup-modal'));
        $("#click-me").on('click', function () {
            $("#popup-modal").modal("openModal");
        });

    }
);

For modal html code is in view/base/web/templates/sendmail.html

<div id="popup-modal" style="display:none;">

//form code

</dive>

this sendmail.js code working on frontend site i have test on phtml file it work but is not work with grid. Can anyone guide me little how to show popup modal in dropdown action? Thanks 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.