I created my custom module with admin grid, then i tried to add order increment id
to my custom grid by altering the grid collection with alias name.
The order id
is displaying in grid. Now, if I try to filter by increment_id
, then it throws an error. Without alias its working fine, if i add alias and try to filter at that time it throws the error.
Following is my code:
<column name="order_id">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">text</item>
<item name="filter_index" xsi:type="string">o.increment_id</item>
<item name="add_field" xsi:type="boolean">false</item>
<item name="label" xsi:type="string" translate="true">Order ID</item>
<item name="sortOrder" xsi:type="number">75</item>
</item>
</argument>
</column>
app\code\Sugarcode\Test\Model\ResourceModel\Test\Grid\Collection.php
protected function _initSelect()
{
parent::_initSelect();
$this->getSelect()->joinLeft(
['o' => 'sales_order_grid'],
"(o.entity_id = main_table.id)",
[
'o.increment_id as order_id'
]
);
//$this->printLogQuery(true);
return $this;
}
So please tell how can I add the filter_index
in magento2 with UI Component ?