2

I'm trying to create View Slider in my custom grid like enter image description here

for that I've followed This and This but in the both cases when I click on my custom link or button it gives me an error in console enter image description here

Now I dont know why this is happening in both of the cases.. any help would be really appreciated

1 Answer 1

1

Please put below div where you want to display data.

<div id="popupId"></div>

and please use below function where you want to open popup Model data.

<script>
    require([
        'jquery',
        'Magento_Ui/js/modal/modal'
    ], function ($,example,modal) {
            var options = {
                type: 'popup',
                responsive: true,
                innerScroll: true,
                buttons: [{
                    text: $.mage.__('Continue'),
                    class: 'primary action submit btn btn-default',
                    click: function () {
                        this.closeModal();
                    }
                }]
            };
    
            jQuery('.order-status-review').on('click', function() {
                var orderId = jQuery(this).data("orderid");
                var commentId = jQuery(this).data("commentid");
                var statusId = jQuery(this).data("statusid");
    
                $.ajax({
                      method: "POST",
                      showLoader: true,
                      url: "<?php  echo $block->getUrl('contrller path'); ?>",
                      data: { orderid: orderId,commentid:commentId,statusid:statusId}
                    })
                  .done(function( data ) {
                      if(data.orderstatusHtml != ""){
                        $("#popupId").html(data.orderstatusHtml).modal(options).modal('openModal'); 
                      }
                  });
            });
        }
    );
    </script>

You can modifed this function as per your requirement.

also, you have to created one controller which fetch data according your need and put it in your popup data div.

i hope this solve your problem

Thanks,

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.