I have an admin form inside which I have added a dropdown and one grid with UI component,
I want to change the grid data or need to apply filers to grid collection based on the selected value inside the dropdown
Ex. if I select option 1 then the grid will show data depending on that option and if I select option 2 then data is based on that value
how can I do this, Your help is appreciated
Solved! Go to Solution.
resolved this problem
Please have a look at the below article for a solution
Thank You.
When you define your fields datatype and filter as select. Magento will automatically display your column filter as dropdown.
Below example code may help you :
<column name="type"> <argument name="data" xsi:type="array"> <item name="options" xsi:type="object">Namespace\Modulename\Model\Config\Source\Departments</item> <item name="config" xsi:type="array"> <item name="filter" xsi:type="string">select</item> <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/select</item> <item name="dataType" xsi:type="string">select</item> <item name="sorting" xsi:type="string">asc</item> <item name="sortOrder" xsi:type="number">2</item> <item name="label" translate="true" xsi:type="string">Departments</item> </item> </argument> </column>
It may help you!
Thank you.
Hello @Bhanu Periwal ,
I don't want to show it at filters,
Want to refresh the grid based on the selected values in dropdown , The drop down is a separate field in admin form, and in the same form I have added a separate grid.
resolved this problem
Please have a look at the below article for a solution
Thank You.