TransWikia.com

How to create a Grid View Slider. Magento 2

Magento Asked by Asad Khan on November 29, 2020

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

One Answer

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,

Answered by Ketan Panchal on November 29, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP