0
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
        <arguments>
            <argument name="collections" xsi:type="array">
                <item name="customerreport_customer_form_data_source" xsi:type="string">Tatva\Subscription\Model\ResourceModel\Subscription\Grid\CollectionReport</item>
                <item name="customerreport_customer_report_data_source" xsi:type="string">Tatva\Subscription\Model\ResourceModel\Subscription\Grid\CollectionSubReport</item>
            </argument>
        </arguments>
    </type>
    <type name="Tatva\Subscription\Model\ResourceModel\Subscription\Grid\CollectionReport">
        <arguments>
            <argument name="mainTable" xsi:type="string">subscription_history</argument>
            <argument name="eventPrefix" xsi:type="string">Tatva_Subscription_grid_collection</argument>
            <argument name="eventObject" xsi:type="string">Tatva_grid_collection</argument>
            <argument name="resourceModel" xsi:type="string">Tatva\Subscription\Model\ResourceModel\Subscription</argument>
        </arguments>
    </type>
    <type name="Tatva\Subscription\Model\ResourceModel\Subscription\Grid\CollectionSubReport">
        <arguments>
            <argument name="mainTable" xsi:type="string">subscription_history</argument>
            <argument name="eventPrefix" xsi:type="string">Tatva_Subscription_report_grid_collection</argument>
            <argument name="eventObject" xsi:type="string">Tatva_report_grid_collection</argument>
            <argument name="resourceModel" xsi:type="string">Tatva\Subscription\Model\ResourceModel\Subscription</argument>
        </arguments>
    </type>
</config>

Is it possible?

  • Did you achieve this? – Saravanan DS Oct 1 '18 at 6:28
  • Yes it is possible – Rutvee Sojitra Oct 1 '18 at 17:14
  • Okay. Thanks. Is that is same way like the code in the question or update the code in the answer if it is not. – Saravanan DS Oct 3 '18 at 5:30
  • @SaravananDS please find my answer and let me know if you have any query – Rutvee Sojitra Oct 3 '18 at 5:34
0

Yes we can define number of datasource in di.xml .

Here is example of 3 datasource define in one di.xml:

      <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
    <arguments>
        <argument name="collections" xsi:type="array">
            <item name="customerreport_customer_form_data_source" xsi:type="string">Tatva\Subscription\Model\ResourceModel\Subscription\Grid\CollectionReport</item>
            <item name="customerreport_customer_report_data_source" xsi:type="string">Tatva\Subscription\Model\ResourceModel\Subscription\Grid\CollectionSubReport</item>
            <item name="customerreport_customer_free_report_data_source" xsi:type="string">Tatva\Customer\Model\ResourceModel\Customer\Grid\Collection</item>
        </argument>
    </arguments>
</type>
<type name="Tatva\Subscription\Model\ResourceModel\Subscription\Grid\CollectionReport">
    <arguments>
        <argument name="mainTable" xsi:type="string">subscription_history</argument>
        <argument name="eventPrefix" xsi:type="string">Tatva_Subscription_grid_collection</argument>
        <argument name="eventObject" xsi:type="string">Tatva_grid_collection</argument>
        <argument name="resourceModel" xsi:type="string">Tatva\Subscription\Model\ResourceModel\Subscription</argument>
    </arguments>
</type>
<type name="Tatva\Customer\Model\ResourceModel\Customer\Grid\Collection">
    <arguments>
        <argument name="mainTable" xsi:type="string">customer_entity</argument>
        <argument name="eventPrefix" xsi:type="string">customer_entity</argument>
        <argument name="eventObject" xsi:type="string">customer_entity</argument>
        <argument name="resourceModel" xsi:type="string">Tatva\Customer\Model\ResourceModel\Customer</argument>
    </arguments>
</type>
<type name="Tatva\Subscription\Model\ResourceModel\Subscription\Grid\CollectionSubReport">
    <arguments>
        <argument name="mainTable" xsi:type="string">subscription_history</argument>
        <argument name="eventPrefix" xsi:type="string">Tatva_Subscription_report_grid_collection</argument>
        <argument name="eventObject" xsi:type="string">Tatva_report_grid_collection</argument>
        <argument name="resourceModel" xsi:type="string">Tatva\Subscription\Model\ResourceModel\Subscription</argument>
    </arguments>
</type>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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