Menu Close
    Start a Project Request quote Reading list Switch to dark mode

    Use Nested Queries in Magento2 Admin UiGrid

    In this blog we, will be learning how to use nested queries in Magento2 Ui Admin Grid for creating the desired result set.

    You can check the basics of creating the Ui admin grid at:
    and the basics of creating virtual columns using nested queries in Magento 2 at:

    The advantages of using virtual columns in your data set is that you can actually use the default filters on those columns that are created virtually using nested queries.

    To implement the same, we need to go to the file: Webkul\Hello\Model\ResourceModel\Employee\Grid\Collection and implement the method: _renderFiltersBefore()

    This method is called before rendering the filters and the same is called before applying the filters on the UiGrid

    The nested query(as described in the previous mentioned) blog will be implemented in the Collection file as:

    Now, the column customer_fullname can be used in the UiGrid and the filters will be working on the same also, automatically as the virtual column now actually exists in the result set

    If you have any doubts or queries, please put in the comments section.

    . . .


    Add Your Comment

    Be the first to comment.

    Back to Top
    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