I want to write a render to add one of the column in the Gird. It needs to retrieve data from the vendor_module_slide_store. I wrote a function to get store_id from that table, by using the key (slide_id). I am appreciate for any help.
$this->addColumn(
'store_id',
[
'header' => __('Store View4'),
'index' => 'store_id',
'filter' => false,
'renderer' => 'VendorModuleBlockAdminhtmlGridColumnStore'
]
);
Below is the Render part. VendorModuleBlockAdminhtmlGridColumnStore.php
<?php
namespace VendorModuleBlockAdminhtmlGridColumn;
class Store extends MagentoFrameworkModelResourceModelDbAbstractDb
{
/**
* @param int $id
* @return array
*/
public function getStoreCodeById($id)
{
$connection = $this->getConnection();
$select = $connection->select()->from(
$this->getTable('vendor_module_slide_store'),
'store_id'
)->where(
'slide_id = :slide_id'
);
$binds = [':slide_id' => (int)$id];
return $connection->fetchCol($select, $binds);
}
}