Magento grids plays vital role when it comes to displaying data in efficient way. Filtration to these grids are an added charm to get accurate data based on requirements. Once we require a specific implementation to filter UI component grid collection.

Here, I’m going to share the custom code which you can implement to UI component grid collection in Magento 2.

Paste the below code in UI component grid xml file to create a column. Use the same code with required changes to create as many columns as you want.

From the above code, make changes as shown below to fetch the filter options. Inside the argument tag, you can see an item tag with name filter_url_params 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. Below code displays the example of filter by status on a collection, here you need to pass the status value through URL.

Hope this blog has helped you to filter grid collection in proper way.

Let me know if you stuck with any issue, I’ll be glad to help you. Waiting for your feedback and reviews in comment section below.

Click to rate this post!
[Total: 9 Average: 4]