Skip to content

filterUrlParams property not generating ajax url param on admin grid

i m struggling with an issue on Magento 2.4.5 creating a custom module on admin. I have created a 2 column ui with a form and listing, which renders a grid on the admin, however, no matter what i have tried, i m not able to pass the initial url param i.e. entity_id/1 to the ajax request of the grid.
I have used filter_url_params attribute on my xml, but still doesn’t seem to have any affect on it.

My code looks like this

xxx_form.xml

        <insertListing name="XXXX_YYYY_item_listing" component="Magento_Customer/js/form/components/insert-listing">
            <settings>
                <dataLinks>
                    <exports>false</exports>
                    <imports>true</imports>
                </dataLinks>
                <externalProvider>XXXX_YYYY_item_listing.XXXX_YYYY_item_listing_data_source</externalProvider>
                <selectionsProvider>XXXX_YYYY_item_listing.XXXX_YYYY_item_listing.XXXX_YYYY_item_listing_columns.ids</selectionsProvider>
                <autoRender>true</autoRender>
                <dataScope>XXXX_YYYY_item_listing</dataScope>
                <ns>XXXX_YYYY_item_listing</ns>
                <exports>
                    <link name="entity_id">${ $.externalProvider }:params.parent_id</link>
                </exports>
                <imports>
                    <link name="entity_id">${ $.provider }:data.entity_id</link>
                </imports>
            </settings>
        </insertListing>

listing.xml

<listing>
    ...
    <dataSource name="XXXX_YYYY_item_listing_data_source" component="Magento_Ui/js/grid/provider">
        <settings>
            <filterUrlParams>
                <param name="entity_id">*</param>
            </filterUrlParams>
            <storageConfig>
                <param name="indexField" xsi:type="string">entity_id</param>
            </storageConfig>
            <updateUrl path="mui/index/render"/>
        </settings>
        <aclResource>XXXX_YYYY::YYYY</aclResource>
        <dataProvider name="XXXX_YYYY_item_listing_data_source"
                      class="XXXXYYYYUiComponentListingDataProvider">
            <settings>
                <requestFieldName>entity_id</requestFieldName>
                <primaryFieldName>entity_id</primaryFieldName>
            </settings>
        </dataProvider>
    </dataSource>
    ...
</isting>

The generated url looks like this

https://magento2.localhost.com/admin_1qmg8u/mui/index/render/key/873ebb66c3e249554d98becb8e6242feebfa6231878f6013e987659ee02bdd66/?namespace=XXXX_YYYY_item_listing&sorting%5Bfield%5D=entity_id&sorting%5Bdirection%5D=asc&filters%5Bplaceholder%5D=true&paging%5BpageSize%5D=20&paging%5Bcurrent%5D=1&isAjax=true

while it should look like this

https://magento2.localhost.com/admin_1qmg8u/mui/index/render/key/873ebb66c3e249554d98becb8e6242feebfa6231878f6013e987659ee02bdd66/?namespace=XXXX_YYYY_item_listing&entity_id=1&sorting%5Bfield%5D=entity_id&sorting%5Bdirection%5D=asc&filters%5Bplaceholder%5D=true&paging%5BpageSize%5D=20&paging%5Bcurrent%5D=1&isAjax=true