I created a custom column "product_name" in sales/order grid,
When I am sorting this column grid showing error:
Item (Magento\Framework\View\Element\UiComponent\DataProvider\Document) with the same id "146" already exist
My collection code is :
parent::_initSelect();
$joinTable = $this->getTable('mg_dispatch_date');
$joinTable2 =$this->getTable('customer_entity_varchar');
$joinTable3 = $this->getTable('catalog_product_entity_varchar');
$this->getSelect()->join($joinTable . ' as mdd', 'main_table.entity_id = mdd.order_id', array('*'));
$this->getSelect()->join($joinTable2. ' as fn', 'main_table.customer_id = fn.entity_id and fn.attribute_id = 177',array('value'));
$this->getSelect()->join($joinTable3.' as cpev','main_table.entity_id = cpev.entity_id', array('*'));
return $this;
and sales_order_item.xml
code is :
<column name="product_name" class="Magecoder\Customerref\Ui\Component\Listing\Column\Productname">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="boolean">false</item>
<item name="sortable" xsi:type="boolean">true</item>
<item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">Product Name</item>
</item>
</argument>
</column>
Please help is anyone have suggestion, Thanks in Advance.