1) Update GoFlyyGetOrder.php Add id in Button
Vendor/Module/Ui/Component/Listing/Column/GoFlyyGetOrder.php
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
$fieldName = $this->getData('name');
foreach ($dataSource['data']['items'] as & $item) {
$order = $this->orderRepository->get($item["entity_id"]);
$goFlyyOrderId = $order->getData("goflyy_order_id");
if($goFlyyOrderId){
$item[$fieldName] = "<button class='button' id='FlyyOrderId_$goFlyyOrderId'><span>$goFlyyOrderId</span></button>";
}
}
}
return $dataSource;
}
After Call Phtml in Sales Order Grid
2) Create a File and add the code given below
File : Vendor/Module/view/adminhtml/layout/sales_order_grid.xml
<?xml version="1.0" encoding="UTF-8"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="root">
<block class="Vendor\Module\Block\Adminhtml\FlyOrder" template="Vendo_Module::view/flyorder.phtml" name="vendor.fly.order" />
</referenceContainer>
</body>
</page>
3) Create a block class and add a code
File : Vendor\Module\Block\Adminhtml\FlyOrder.php
namespace Vendor\Module\Block\Adminhtml;
class FlyOrder extends \Magento\Backend\Block\Template
{
//Get Collection of goFlyyOrderId add you Logic
public function getFlyyOrderId(){
---------------------
return
}
}
4) Create a template file flyorder.phtml in path
File : Vendor/Module/view/adminhtml/templates/view/flyorder.phtml
<div id="popup-modal-main<?php echo $block->getFlyyOrderId();?>" style="display:none;">
Fly Order Id <?php echo $block->getFlyyOrderId();?>
</div>
<script type="text/javascript">
require([
'jquery',
'Magento_Ui/js/modal/modal'
], function($, modal) {
$(document).ready(function(){
var options = {
type: 'popup',
responsive: true,
innerScroll: true,
title: 'Open Modal'
};
$("#FlyyOrderId_<?php echo $block->getFlyyOrderId();?>").on('click',function(){
$("#popup-modal-main<?php echo $block->getFlyyOrderId();?>").modal(options).modal('openModal');
});
});
});
</script>