magento2
magento2 copied to clipboard
Magento_Ui/js/modal/modal-component cannot be used inside dynamic rows
Preconditions and environment
- 2.3.2
Steps to reproduce
- Create a new UI form using dynamic rows.
- Inside the dynamic rows add a button and a modal ui component, that will be triggered when the button is clicked.
- Open the UI form and add a new row in the ui component
- Check console and find a javascript error that visible() is not a function.
Expected result
Modal is opened properly
Actual result
Javascript error
Additional information
The problem is coming from Magento_Ui/js/modal/modal-component which doesn't have a visible property set. Therefore when the dynamic rows component tries to set visibility, the error will come up
Sample code to replicate
<fieldset name="products" sortOrder="20">
<settings>
<label translate="true">Products</label>
</settings>
<dynamicRows name="dynamic_rows" sortOrder="70">
<settings>
<addButtonLabel translate="true">Add Product</addButtonLabel>
<additionalClasses>
<class name="admin__field-wide">true</class>
</additionalClasses>
<componentType>dynamicRows</componentType>
</settings>
<container name="record" component="Magento_Ui/js/dynamic-rows/record">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="isTemplate" xsi:type="boolean">true</item>
<item name="is_collection" xsi:type="boolean">true</item>
<item name="componentType" xsi:type="string">container</item>
</item>
</argument>
<field name="quantity" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="fit" xsi:type="boolean">false</item>
</item>
</argument>
<settings>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
</validation>
<dataType>number</dataType>
<label>Quantity</label>
</settings>
</field>
<button name="products" component="Magento_Ui/js/form/components/button">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">
Select Products
</item>
<item name="title" xsi:type="string" translate="true">
Products
</item>
<item name="displayAsLink" xsi:type="boolean">true</item>
<item name="labelVisible" xsi:type="boolean">true</item>
<item name="template" xsi:type="string">ui/form/components/button/container</item>
<item name="actions" xsi:type="array">
<item name="0" xsi:type="array">
<item name="targetName" xsi:type="string">${$.parentName}.products_modal</item>
<item name="actionName" xsi:type="string">openModal</item>
</item>
</item>
</item>
</argument>
</button>
<modal name="products_modal">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="provider" xsi:type="string">io_quickorder_form.io_quickorder_form_data_source</item>
<item name="onCancel" xsi:type="string">actionDone</item>
<item name="options" xsi:type="array">
<item name="title" xsi:type="string">All Products</item>
<item name="buttons" xsi:type="array">
<item name="0" xsi:type="array">
<item name="text" xsi:type="string">Selected</item>
<item name="class" xsi:type="string">action-primary</item>
<item name="actions" xsi:type="array">
<item name="0" xsi:type="array">
<item name="targetName" xsi:type="string">index = product_listing</item>
<item name="actionName" xsi:type="string">save</item>
</item>
<item name="1" xsi:type="string">closeModal</item>
</item>
</item>
</item>
</item>
</item>
</argument>
<insertListing name="product_listing">
<settings>
<dataLinks>
<exports>false</exports>
<imports>true</imports>
</dataLinks>
<autoRender>true</autoRender>
<selectionsProvider>product_listing.product_listing.columns.ids</selectionsProvider>
<dataScope>product_listing</dataScope>
<ns>product_listing</ns>
</settings>
</insertListing>
</modal>
</container>
</dynamicRows>
</fieldset>
Release note
No response
Triage and priority
- [ ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- [X] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Hi @ioweb-gr. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
-
@magento give me 2.4-develop instance
- upcoming 2.4.x release - For more details, review the Magento Contributor Assistant documentation.
- Add a comment to assign the issue:
@magento I am working on this
- To learn more about issue processing workflow, refer to the Code Contributions.
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
- [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
- [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
- [ ] 3. Add
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to. - [ ] 4. Verify that the issue is reproducible on
2.4-develop
branchDetails
- Add the comment@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-develop
branch, please, add the labelReproduced on 2.4.x
.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here! - [ ] 5. Add label
Issue: Confirmed
once verification is complete. - [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hello @ioweb-gr,
Thank you for the report and collaboration!
We were able to reproduce this issue on 2.4-develop.
Please take a look at the screenshot below:
When adding a new row in the ui component we got the error
data.visible is not a function
, hence confirming this issue.
Please find the custom module used to reproduce this issue. UiComponentVendor.zip
Thank you.
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-10636 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
Is there any work around for this?