1

I am trying to get request param id when editing the page in my component dataprovider file. But getting always null value in it.

I am rendering a grid in the product edit page and I need to filter my data based on the current edit page. and when I try to click on the tab it fires the mui/index/render action and does not get product id in it.

I have also tried using this code (int)$this->request->getParam('current_product_id'); but it is also returning an empty value. can anyone please guide me on this?

even in the registry not available.

Here is the dataSource tag from my ui component file

<dataSource name="pricelist_listing_data_source">
    <argument name="dataProvider" xsi:type="configurableObject">
        <argument name="class" xsi:type="string">Test\PriceLevel\Ui\DataProvider\Product\PricelistDataProvider</argument>
        <argument name="name" xsi:type="string">pricelist_listing_data_source</argument>
        <argument name="primaryFieldName" xsi:type="string">id</argument>
        <argument name="requestFieldName" xsi:type="string">entity_id</argument>
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
                <item name="update_url" xsi:type="url" path="mui/index/render"/>
                <item name="storageConfig" xsi:type="array">
                    <item name="cacheRequests" xsi:type="boolean">false</item>
                </item>
            </item>
        </argument>
    </argument>
</dataSource>
4
  • Just print request params and check print_r($this->request->getParams()) Dec 27, 2021 at 9:18
  • @NalinSavaliya it was working fine before 2.3 but not working in 2.4 and there isny't any edit ID in params
    – M2 Dev
    Dec 27, 2021 at 12:17
  • could you please share XML code of your listing component?
    – Max
    Dec 27, 2021 at 13:57
  • @Max edited question and shared datasource node from ui component
    – M2 Dev
    Dec 27, 2021 at 14:03

1 Answer 1

0

Try this code. Add your filter_url_params

.......................................................................................
.......................................................................................

<dataSource name="abandoned_cart_email_schedule_listing_data_source">
    <argument name="dataProvider" xsi:type="configurableObject">
        <argument name="class" xsi:type="string">AbandonedCartEmailScheduleFilterPool</argument>
        <argument name="name" xsi:type="string">abandoned_cart_email_schedule_listing_data_source</argument>
        <argument name="primaryFieldName" xsi:type="string">scheduler_id</argument>
        <argument name="requestFieldName" xsi:type="string">scheduler_id</argument>
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
                <item name="update_url" xsi:type="url" path="mui/index/render"/>
                <item name="storageConfig" xsi:type="array">
                    <item name="indexField" xsi:type="string">scheduler_id</item>
                </item>
                <item name="filter_url_params" xsi:type="array">
                    <item name="row_id" xsi:type="string">*</item>
                </item>
            </item>
        </argument>
    </argument>
    <argument name="data" xsi:type="array">
        <item name="js_config" xsi:type="array">
            <item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
        </item>
    </argument>
</dataSource>

.......................................................................................
.......................................................................................
1
  • already tried this way.but nothing happen
    – M2 Dev
    Dec 27, 2021 at 7:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.