I have a grid which is replicated from the sales_order_grid. I want to show only the processing orders in the grid.So what can be done to filter that?
2 Answers
We can add a filterUrlParam to filter the grid.
<dataSource name="grid_record_grid_list_data_source" component="Magento_Ui/js/grid/provider">
<settings>
<updateUrl path="mui/index/render"/>
<filterUrlParams>
<param name="status">processing</param>
</filterUrlParams>
</settings>
<aclResource>Magento_Sales::sales_order</aclResource>
<dataProvider class="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider" name="grid_record_grid_list_data_source">
<settings>
<requestFieldName>id</requestFieldName>
<primaryFieldName>main_table.entity_id</primaryFieldName>
</settings>
</dataProvider>
</dataSource>
In the above code there is filterUrlParams tag which is responsible to filter collection. In order to make it work, set parameter name inside name attribute of item tag through which you require to filter.
Alternative method of doing this is:
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="update_url" xsi:type="url" path="mui/index/render"/>
<item name="filter_url_params" xsi:type="array">
<item name="is_active" xsi:type="string">1</item>
</item>
</item>
</argument>
what is we have to filter grid with Date Range date from and date to? and in my edit form there is one ui form after that ui grid ,so how to get form data in banner grid?
-
We can add multiple fields in the filter. I am not able to understand the last part of your question. If you use a block to render the grid, you can use the DataObject to get all the row data.– JasonCommented Aug 21, 2022 at 1:24