In this example
<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="status" xsi:type="string">*</item>
</item>
</item>
</argument>
How to filter uicomponent grid with multiple url param values ? Like 1,2 not all the values
Best Answer
If you have a requirement as load an admin grid with pre-defined multiple filter values like below:
Then you can go in the
dataprovider
class of the uicomponent grid and make below changes(add belowprepareUpdateUrl
function code):In above code, I am checking paramName as
if ($paramName == 'status')
then explode this paramValue as$paramValue = explode(',', $paramValue);
and adding a new filter as below:$this->addFilter($this->filterBuilder->setField($paramName)->setValue($paramValue)->setConditionType('in')->create());
And changing the filter condition from
eq
toin
. This solution is very well tested and working live in one of my module, so let me know if you face any issue. Thanks :)