enter image description hereI have a grid and I want to apply a custom filter on it, is there a way do that ? Thank you

  • Please provide more information. Did you use UI Component? – Salma Saiyad Dec 21 '17 at 13:21
  • Please check below URL magento.stackexchange.com/questions/95371/… – Nits Dec 21 '17 at 13:24
  • @SalmaSaiyad yes, i used ui component I have the filters of the default columns I want to add a custom filter, I added a photo that indicates the filter location to the question – lisa Dec 21 '17 at 13:31
  • @lisa You can take a reference from following answer – Salma Saiyad Dec 26 '17 at 4:33

You can take the reference for Status filter added in following XML to add custom filters. More information you can find here. http://devdocs.magento.com/guides/v2.2/ui_comp_guide/components/ui-filters.html

<listingToolbar name="listing_top">
        <bookmark name="bookmarks"/>
        <columnsControls name="columns_controls"/>
        <filters name="listing_filters">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="params" xsi:type="array">
                        <item name="filters_modifier" xsi:type="array"/>
                    <item name="observers" xsi:type="array">
                        <item name="filters" xsi:type="object">Magento\Catalog\Ui\Component\Listing\Filters</item>
                    <property name="applied" xsi:type="boolean">false</property>
        <filterSelect name="status" provider="${ $.parentName }">
                <options class="Magento\Catalog\Model\Product\Attribute\Source\Status"/>
                <caption translate="true">Select...</caption>
                <label translate="true">Status</label>
                    <link name="visible">componentType = column, index = ${ $.index }:visible</link>
        <paging name="listing_paging"/>
| improve this answer | |
  • Do you know how can we apply filter logic to query? I mean in which file we can add if you find custom filter (here status) then apply the filter logic. – Knight017 Jan 2 '19 at 17:39
  • @Knight017, were you able to find how can we apply filter logic – surbhi agr Jul 29 at 6:16
  • @surbhiagr not remeber exactly, but we have to find out the file which is used for collection filter from core,may be in di.xml where they specify the class , then need to rewrite it or we update it in di.xml and add the logic there. – Knight017 2 days ago

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.