magento2 - Magento 2 admin grid add filter to collection -


i created grid in admin xml ui components. need filter collection via url parameter , dont know how achieve that. tried inject requestinterface collection, filter didnt work.

di.xml

<virtualtype name="slidelistingdataprovider" type="magento\framework\view\element\uicomponent\dataprovider\dataprovider">         <arguments>             <argument name="collection" xsi:type="object" shared="false">xxx\xxx\model\resourcemodel\grid\slide\collection</argument>             <argument name="filterpool" xsi:type="object" shared="false">slidelistingfilterpool</argument> <!-- define new object filters -->         </arguments>     </virtualtype>      <virtualtype name="slidelistingfilterpool" type="magento\framework\view\element\uicomponent\dataprovider\filterpool">         <arguments>             <argument name="appliers" xsi:type="array">                 <item name="regular" xsi:type="object">magento\framework\view\element\uicomponent\dataprovider\regularfilter</item>                 <item name="fulltext" xsi:type="object">magento\framework\view\element\uicomponent\dataprovider\fulltextfilter</item>             </argument>         </arguments>     </virtualtype>      <virtualtype name="xxx\xxx\model\resourcemodel\grid\slide\collection" type="xxx\xxx\ui\component\dataprovider\searchresult\slide">         <arguments>             <argument name="maintable" xsi:type="string">advox_sliders_slide</argument>             <argument name="resourcemodel" xsi:type="string">xxx\xxx\model\resourcemodel\slide</argument>         </arguments>     </virtualtype> 

you have write after update_url in ui components

`<item name="update_url" xsi:type="url" path="mui/index/render"/>` 

after line have add below code

<item name="filter_url_params" xsi:type="array"> <item name="status" xsi:type="boolean">1</item> </item>

now have pass status value in url.


Comments

Popular posts from this blog

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -