0

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.

asked Jan 16, 2023 at 12:23

2 Answers 2

0

You can Refer below link and follow the steps:-
https://www.rohanhapani.com/magento-2-create-ui-component-grid-and-form/

answered Jan 16, 2023 at 13:25
1
  • thanks for the referance Commented Jan 17, 2023 at 11:26
0

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.

answered Jan 16, 2023 at 16:09
1
  • Thanks for the referance Commented Jan 17, 2023 at 11:26

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.