VANHIEP.NET - Làm web giá rẻ - Thiết Kế Website - Thiết Kế Ứng Dụng Mobile
[Magento] - How to create a modal that opens when clicking a button and simultaneously calls a data list within the modal.

[Magento] - How to create a modal that opens when clicking a button and simultaneously calls a data list within the modal.

Implementing a Modal Popup Activated by Button Click with an Embedded Data List

Step 1: Create a button.

In the directory Vendor / Module / View / adminhtml / ui_component. Please open the 'ui_component' file where you want to add the button.

[Magento] - How to create a modal that opens when clicking a button and simultaneously calls a data list within the modal.

Here I will add a button to the 'banner_form.xml' form. I will input the content of the file as follows. Please skip the comment section.

[Magento] - How to create a modal that opens when clicking a button and simultaneously calls a data list within the modal.

[Magento] - How to create a modal that opens when clicking a button and simultaneously calls a data list within the modal.

[Magento] - How to create a modal that opens when clicking a button and simultaneously calls a data list within the modal.

And we'll get the result as follows.

[Magento] - How to create a modal that opens when clicking a button and simultaneously calls a data list within the modal.

Please note that in this example, I already have a Banner module and have declared the 'banner_form.xml' file previously. In this instance, we are adding content to this form when declaring it in another module.

[Magento] - How to create a modal that opens when clicking a button and simultaneously calls a data list within the modal.

Step 2: Create a UI component list for the content of the modal.

In this example, I'll display a product list in a modal when the user clicks a button and the modal opens. In the directory Vendor/Module/view/adminhtml/ui_component, I'll create a file named product_listing2.xml

[Magento] - How to create a modal that opens when clicking a button and simultaneously calls a data list within the modal.[Magento] - How to create a modal that opens when clicking a button and simultaneously calls a data list within the modal.[Magento] - How to create a modal that opens when clicking a button and simultaneously calls a data list within the modal.[Magento] - How to create a modal that opens when clicking a button and simultaneously calls a data list within the modal.[Magento] - How to create a modal that opens when clicking a button and simultaneously calls a data list within the modal.[Magento] - How to create a modal that opens when clicking a button and simultaneously calls a data list within the modal.[Magento] - How to create a modal that opens when clicking a button and simultaneously calls a data list within the modal.[Magento] - How to create a modal that opens when clicking a button and simultaneously calls a data list within the modal.[Magento] - How to create a modal that opens when clicking a button and simultaneously calls a data list within the modal.

We will get the following result.

[Magento] - How to create a modal that opens when clicking a button and simultaneously calls a data list within the modal.