Menu Close
    Hire us 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: https://webkul.com/blog/how-to-create-a-grid-using-ui-component/
    and the basics of creating virtual columns using nested queries in Magento 2 at: https://webkul.com/blog/creating-virtual-columns-in-magento2-by-using-nested-queries/

    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.

    . . .

    Comment

    Add Your Comment

    Be the first to comment.

    Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just received your message and our expert will get back to you shortly.
    Send Again
    Close