1

listing file

<argument name="data" xsi:type="array">
    <item name="js_config" xsi:type="array">
        <item name="provider" xsi:type="string">faq_listing.faq_listing_data_source</item>
    </item>
</argument>
<settings>
    <spinner>faq_listing_columns</spinner>
    <deps>
        <dep>faq_listing.faq_listing_data_source</dep>
    </deps>
</settings>
<dataSource name="faq_listing_data_source" component="Magento_Ui/js/grid/provider">
    <settings>
        <storageConfig>
            <param name="indexField" xsi:type="string">faq_id</param>
        </storageConfig>
        <updateUrl path="mui/index/render"/>
    </settings>
    <dataProvider class="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider" name="faq_listing_data_source">
        <settings>
            <requestFieldName>faq_id</requestFieldName>
            <primaryFieldName>faq_id</primaryFieldName>
        </settings>
    </dataProvider>
</dataSource>
<columns name="customer_online_columns">
    <column name="customer_id">
        <settings>
            <filter>textRange</filter>
            <label translate="true">ID</label>
            <sorting>asc</sorting>
        </settings>
    </column>
    <column name="title">
        <settings>
            <filter>text</filter>
            <label translate="true">title</label>
        </settings>
    </column>
</columns>

/etc/di.xml

<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
    <arguments>
        <argument name="collections" xsi:type="array">
            <item name="faq_listing_data_source" xsi:type="string">Magento\Faq\Model\ResourceModel\Faq\Grid\Collection</item>
        </argument>
    </arguments>
</type>

<virtualType name="Magento\Faq\Model\ResourceModel\Faq\Grid\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
    <arguments>

This error are comes to my screen so how to resolve this error ?

Fatal error: Uncaught TypeError: Argument 2 passed to Magento\Framework\View\Element\UiComponentFactory::argumentsResolver() must be of the type array, null given, called in /var/www/html/magento_2_2_4/vendor/magento/framework/View/Element/UiComponentFactory.php on line 206 and defined in /var/www/html/magento_2_2_4/vendor/magento/framework/View/Element/UiComponentFactory.php:172 Stack trace: #0 /var/www/html/magento_2_2_4/vendor/magento/framework/View/Element/UiComponentFactory.php(206): Magento\Framework\View\Element\UiComponentFactory->argumentsResolver('faq_listing', NULL) #1 /var/www/html/magento_2_2_4/vendor/magento/framework/View/Layout/Generator/UiComponent.php(135): Magento\Framework\View\Element\UiComponentFactory->create('faq_listing', NULL, Array) #2 /var/www/html/magento_2_2_4/vendor/magento/framework/View/Layout/Generator/UiComponent.php(97): Magento\Framework\View\Layout\Generator\UiComponent->generateComponent(Object(Magento\Framework\View\Layout\Data\Structure), 'faq_listing', Array, Object(Magento\Framew in /var/www/html/magento_2_2_4/vendor/magento/framework/View/Element/UiComponentFactory.php on line 172

2 Answers 2

1

Your column name customer_online_columns is miss-match. Please check below code is updated and working

<argument name="data" xsi:type="array">
    <item name="js_config" xsi:type="array">
        <item name="provider" xsi:type="string">faq_listing.faq_listing_data_source</item>
        <item name="deps" xsi:type="string">faq_listing.faq_listing_data_source</item>
    </item>
    <item name="spinner" xsi:type="string">faq_listing_columns</item>
</argument>
<dataSource name="faq_listing_data_source">
    <argument name="dataProvider" xsi:type="configurableObject">
        <argument name="class" xsi:type="string">Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider</argument>
        <argument name="name" xsi:type="string">faq_listing_data_source</argument>
        <argument name="primaryFieldName" xsi:type="string">faq_id</argument>
        <argument name="requestFieldName" xsi:type="string">faq_id</argument>
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="update_url" xsi:type="url" path="mui/index/render"/>
            </item>
        </argument>
    </argument>
    <argument name="data" xsi:type="array">
        <item name="js_config" xsi:type="array">
            <item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
        </item>
    </argument>
</dataSource>
<columns name="faq_listing_columns">
    <selectionsColumn name="ids">
       <argument name="data" xsi:type="array">
           <item name="config" xsi:type="array">
               <item name="indexField" xsi:type="string">faq_id</item>
               <item name="sorting" xsi:type="string">desc</item>
               <item name="sortOrder" xsi:type="number">0</item>
           </item>
       </argument>
   </selectionsColumn>
   <column name="customer_id">
       <argument name="data" xsi:type="array">
           <item name="config" xsi:type="array">
               <item name="filter" xsi:type="string">number</item>
               <item name="label" xsi:type="string" translate="true">ID</item>
               <item name="sortOrder" xsi:type="number">10</item>
           </item>
       </argument>
   </column>
    <column name="title">
       <argument name="data" xsi:type="array">
           <item name="config" xsi:type="array">
               <item name="filter" xsi:type="string">text</item>
               <item name="label" xsi:type="string" translate="true">title</item>
               <item name="sortOrder" xsi:type="number">20</item>
           </item>
       </argument>
    </column>
</columns>
3
  • Just responding with a different bit of code and no explanation is not a good way to answer questions. Explain what column mismatch means. Winmerging the two definitions makes your answer no clearer. Commented Feb 15, 2022 at 18:51
  • @AdamLavery I updated my answer and for the next post, I will take care of it.
    – Msquare
    Commented Feb 16, 2022 at 5:25
  • HI @msquare, thanks for updating but for further clarity customer_online_columns is a mismatch with what directive - spinnner? These UI components are overly complicated and docs/useful examples are lacking so trying to work out how to work them is not easy! One day there'll be an "ah" moment but not there yet! Commented Feb 16, 2022 at 9:47
0

Check the parent and child class constructors, child class constructor may not be passing all the required arguments to will calling the parent constructor.
After making the constructor arguments same run php bin/magento setup:upgrade from CLI

0

Your Answer

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

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