1

I have added dropdown dialog using bellow code

<div class="block block-demo-dialog empty"
     data-role="dropdownDialog"
     data-mage-init='{"dropdownDialog":{
        "appendTo":"[data-block=demo-dialog]",
        "triggerTarget":".showdialog",
        "timeout": "2000",
        "closeOnMouseLeave": false,
        "closeOnEscape": true,
        "triggerClass":"active",
        "parentClass":"active",
        "buttons":[{"text":"x","class":"close-dialog-popup","click":"close"}]}}'>

using above code dialog popup, not opening ... if I removed buttons content

("buttons":[{"text":"x","class":"close-dialog-popup","click":"close"}])

then all working but I want Close Button using data-mage-init anyone has an idea how to use buttons with data-mage-init.

1
  • closeOnClickOutside:true try this might help you Commented Mar 18, 2021 at 10:38

1 Answer 1

0

Try like that:

<div class="block block-demo-dialog empty"
     data-role="dropdownDialog"
     data-mage-init='{"dropdownDialog":{
        "appendTo":"[data-block=demo-dialog]",
        "triggerTarget":".showdialog",
        "timeout": "2000",
        "closeOnMouseLeave": false,
        "closeOnEscape": true,
        "triggerClass":"active",
        "parentClass":"active",
        "buttons":[{text: $.mage.__('x'),click: function () {$(this).dropdownDialog("close");}}]}}'>
1
  • Not working..... Commented Mar 18, 2021 at 7:34

Your Answer

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

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