4

I add a custom select attribute in product, I can show it in the grid listing of custom module. But how to make a default custom_attribute filter? You could look the example image below, which I want filter the collection to show Image Request with requesting.

Add default custom_attribute filter to product grid in Magento 2.1

You could try solution in Magento 2.1 vendor\magento\module-catalog\view\adminhtml\ui_component\product_listing.xml. Had better use ui_component way.

I had tried some ways in our site, all doesn't work, below are the solutions which doesn't work in Magento2.1.

To add default filter to grid in Magento2?

Magento 2 : How can I load an admin grid with pre-defined filter values?

3

After trying many codes which doesn't work, finally find a way doesn't need coding - make use of saving custom views function which could save filter and column settings.

Specific steps

After setting filter and column settings, click on the Default View button with the eye icon, then click Save View As… to enter a name for your view. Then you could click the custom view whenever you want to get the grid just the way you like it, and you can save custom views as many as you like.

You can also go back and use the edit icon to rename it or delete it later on, or to return to the default view.

I think this is a very good function in Magento 2 :)

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.