4

I added a grid to a ui_component form and I want to use an Url-parameter to filter the content of the grid. Herefore I added the 'filter_url_params' in my listing:

    <dataSource name="mcas_covertemplate_graphicelement_listing_data_source">
    <argument name="dataProvider" xsi:type="configurableObject">
        <argument name="class" xsi:type="string">Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider</argument>
        <argument name="name" xsi:type="string">mcas_covertemplate_graphicelement_listing_data_source</argument>
        <argument name="primaryFieldName" xsi:type="string">graphicelement_id</argument>
        <argument name="requestFieldName" xsi:type="string">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="filter_url_params" xsi:type="array">
                    <item name="cover_id" xsi:type="string">*</item>
                </item>
                <item name="storageConfig" xsi:type="array">
                    <item name="indexField" xsi:type="string">graphicelement_id</item>
                </item>
            </item>
        </argument>
    </argument>
</dataSource>

The cover_id is visible in my Url, but it is not used to set the filter. If I set a value for the cover_id manually it works.

What I am doing wrong?

3
  • try after cache clear and compile once as code since perfect Mar 4, 2020 at 4:26
  • Can you please show your model grid collection file ? Mar 6, 2020 at 12:10
  • Can you show your di.xml ?
    – Msquare
    Mar 7, 2020 at 7:09

1 Answer 1

3

In order to help the Magento 2 Community I have pushed a simple repository here https://bitbucket.org/shinedev/helpdesk-stackexchange/ it could be cloned and the it could be edited.

You can install this little sample in your Magento 2.3.x store and click at the Helpdesk button in the menu.

The Aim is understanding how to nest a listing grid created by the new UIComponent within a UiComponent form.

Ticket UIComponent Form

At the moment I have succedeed to get the ticket_id by a simple session variable but this is not the main aim and it is not a good workaround too. I would like to understand how Magento 2 developers pass the data from one to another UIComponent.

Furthermore I have already explained here https://magento.stackexchange.com/a/306136/2004 how this thread is really popular at the Magento Community.

1
  • Have you ever found a way to make this work without the session variable ?
    – Badong
    Oct 9, 2020 at 7:43

Your Answer

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

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