Menu Close
    Start a Project Request quote Reading list Switch to dark mode
    magento-hyperlocal-marketplace-guide

    Magento2 Multi-select Filter on Admin Grid

    Add Multi-select Filter on Admin Grid

    Here i am going explain how to add Multi-select Filter on Admin Grid by ui-Component.

    I am going to add Multi-select filter on customer grid, you can even add it on your
    custom Module’s grid as well.

    1. Create file:
    Webkul/MultiSelectFilter/view/adminhtml/ui_component/customer_listing.xml

    Note: Webkul is Package Name and MultiSelectFilter is Module Name.


    2. Lets create File: Webkul\MultiSelectFilter\Model\PrivateGroup\GroupList.php


    3. Finally flush the cache and load customer grid.

    you will be able to see like below image:

    Thats’s it. For further queries please comment below.

    . . .

    Comments (10)

    Add Your Comment

  • M
    Where’s the following file:
    Webkul\MultiSelectFilter\Ui\Component\Listing\Column\Customer\Groups
    • Mahesh Singh
      This file is used to modify column value, you can remove it, if your column value is the same as you want.
  • John
    What is this class? Thanks!
    • Mahesh Singh
      John, Where is the issue? please explain.
  • akshay
    it adds blank field after the filters[] that’s why getting all the records while making the filter multiselect.
    So how can i change the ajax requests and get proper filtered data.
    • Mahesh Singh
      @Akshay, i have updated the code on blog to add multi-select filter on grid. Please check with the latest update.
      • Akshay
        It is generating error
        Fatal error: Uncaught Error: Call to undefined method Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider::addField() in /var/www/html/magento2.6/vendor/magento/module-ui/Component/Listing/Columns/Column.php:117 Stack trace: #0 /var/www/html/magento2.6/vendor/magento/module-ui/Component/Listing/Columns/Column.php(70): Magento\Ui\Component\Listing\Columns\Column->addFieldToSelect() #1 /var/www/html/magento2.6/vendor/magento/framework/View/Layout/Generator/UiComponent.php(159): Magento\Ui\Component\Listing\Columns\Column->prepare() #2 /var/www/html/magento2.6/vendor/magento/framework/View/Layout/Generator/UiComponent.php(156): Magento\Framework\View\Layout\Generator\UiComponent->prepareComponent(Object(Magento\Ui\Component\Listing\Columns\Column)) #3 /var/www/html/magento2.6/vendor/magento/framework/View/Layout/Generator/UiComponent.php(156): Magento\Framework\View\Layout\Generator\UiComponent->prepareComponent(Object(Magento\Ui\Component\Listing\Columns)) #4 /var/www/html/magento2.6/vendor/magento/framewor in /var/www/html/magento2.6/vendor/magento/module-ui/Component/Listing/Columns/Column.php on line 117
        • Akshay
          Actually I want to convert status filter in multiselect of sales_orders_grid.
          • Manish
            Hi Akshay, I also want to do same functionality, can you please post your code or give me any link from where i can get the code.
        • Mahesh Singh
          Akshay, please remove addField from xml, if you are using this code on your custom grid.
  • Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close