AnswerBun.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!

Related Questions

Invalid template file magento2.3.0

10  Asked on December 10, 2021 by magelerner

       

Composer install .zip could not be downloaded

1  Asked on December 9, 2021 by armando-silva

       

magento 2 updatecart quantity popup

0  Asked on December 9, 2021

 

How to implement One Tap Login in Magento 2?

0  Asked on December 9, 2021 by script-host

   

Use AJAX in magento 2

3  Asked on December 9, 2021

 

Get child category name from category id

1  Asked on December 9, 2021 by karanrp

     

smtp pro run self test error messages

1  Asked on December 7, 2021

   

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir