I have referred this link
Now where I have to place a code for join query multiple table for custom admin grid in magento 2
I have referred many links but got failed for ex.
adding below code in
Company\Module\Model\ResourceModel\Credits\collection.php
protected function _initSelect()
{
echo 'hererer';
die;
parent::_initSelect();
$this->getSelect()->joinLeft(
['secondTable' => $this->getTable('customer_grid_flat')],
'main_table.customer_id = secondTable.entity_id',
array('*')
);
$this->addFilterToMap('firstname', 'secondTable.name');
//$this->addFilterToMap('columnname2_clias', 'secondTable.columnname2');
return $this;
}
<columns name="credit_listing_columns">
<column name="customer_id">
<settings>
<filter>text</filter>
<label translate="true">Customer ID</label>
<sorting>asc</sorting>
</settings>
</column>
<column name="firstname">
<settings>
<filter>text</filter>
<label translate="true">Customer Name</label>
</settings>
</column>
<column name="credit">
...
what is the proper magento procedure or what is wrong with this, also I tried to echo die; inside this function but got failed.
$this->setOrder('id','DESC');:) thank you – SagarPPanchal Oct 01 '18 at 11:06