I have a Category, and Questions form in my custom module. Questions are added against category.
Each question can be belong to a category or multiple category.
I need to insert a listing on category form edit with the questions belongs to relevant category. I Used <insertListing> method in my ayakil_faq_faq_category_form.xml
<fieldset name="faq_information" sortOrder="10">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Faq Information</item>
<item name="collapsible" xsi:type="boolean">false</item>
</item>
</argument>
<insertListing name="faq_listing">
<settings>
<selectionsProvider>ayakil_faq_faq_listing.ayakil_faq_faq_listing_data_source</selectionsProvider>
<dataScope>faq_listing</dataScope>
<ns>faq_listing</ns>
</settings>
</insertListing>
</fieldset>
I need to perform 2 tasks here,
1- need to pass the category id to the data source and
2 - display the faqs related to the category from faq_table.
With my above steps i am unable to get the grid on form, Can anyone please help on this task.
2 Answers 2
You can Refer below link and follow the steps:-
https://www.rohanhapani.com/magento-2-create-ui-component-grid-and-form/
-
thanks for the referanceMujahidh– Mujahidh2023年01月17日 11:26:41 +00:00Commented Jan 17, 2023 at 11:26
You should follow this file path : vendor/magento/module-customer/view/base/ui_component/customer_form.xml
<insertListing name="customer_address_listing" component="Magento_Customer/js/form/components/insert-listing">
<settings>
<dataLinks>
<exports>false</exports>
<imports>true</imports>
</dataLinks>
<externalProvider>customer_address_listing.customer_address_listing_data_source</externalProvider>
<selectionsProvider>customer_address_listing.customer_address_listing.customer_address_columns.ids</selectionsProvider>
<autoRender>true</autoRender>
<dataScope>customer_address_listing</dataScope>
<ns>customer_address_listing</ns>
<exports>
<link name="parent_id">${ $.externalProvider }:params.parent_id</link>
</exports>
<imports>
<link name="parent_id">${ $.provider }:data.customer.entity_id</link>
<link name="onAction">ns = ${ $.ns }, index = actions:action</link>
<link name="onMassAction">ns = ${ $.ns }, index = listing_massaction:massaction</link>
</imports>
</settings>
</insertListing>
And make sure your listing file follows like this : vendor/magento/module-customer/view/adminhtml/ui_component/customer_address_listing.xml
Also you can check the data source in vendor/magento/module-customer/etc/di.xml
If you get a reference for the Magento_Customer module then you achieved it. and also your all questions are solved there.
-
Thanks for the referanceMujahidh– Mujahidh2023年01月17日 11:26:34 +00:00Commented Jan 17, 2023 at 11:26
Explore related questions
See similar questions with these tags.