In my custom module, I want two grids in admin side.I have added the follwing code in di.xml file
<?xml version="1.0"?>
<!--
/**
* @author Cartin24 Team
* @copyright Copyright (c) 2016 Vendor (http://www.cartin24.com)
* @package Vendor_Company
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<virtualType name="CompanyGridFilterPool" type="Magento\Framework\View\Element\UiComponent\DataProvider\FilterPool">
<arguments>
<argument name="appliers" xsi:type="array">
<item name="regular" xsi:type="object">Magento\Framework\View\Element\UiComponent\DataProvider\RegularFilter</item>
<item name="fulltext" xsi:type="object">Magento\Framework\View\Element\UiComponent\DataProvider\FulltextFilter</item>
</argument>
</arguments>
</virtualType>
<virtualType name="CompanyGridDataProvider" type="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider">
<arguments>
<argument name="collection" xsi:type="object" shared="false">Vendor\Company\Model\ResourceModel\Company</argument>
<argument name="filterPool" xsi:type="object" shared="false">CompanyGridFilterPool</argument>
</arguments>
</virtualType>
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
<item name="respbannerslider_data_source" xsi:type="string">Vendor\Company\Model\ResourceModel\Company\Grid\Collection</item>
</argument>
</arguments>
</type>
<type name="Vendor\Company\Model\ResourceModel\Company\Grid\Collection">
<arguments>
<argument name="mainTable" xsi:type="string">cartin24_respslidemaster</argument>
<argument name="eventPrefix" xsi:type="string">respbannerslider_collection</argument>
<argument name="eventObject" xsi:type="string">respbannerslider_collection</argument>
<argument name="resourceModel" xsi:type="string">Vendor\Company\Model\ResourceModel\Company</argument>
</arguments>
</type>
<virtualType name="SlideGridFilterPool" type="Magento\Framework\View\Element\UiComponent\DataProvider\FilterPool">
<arguments>
<argument name="appliers" xsi:type="array">
<item name="regular" xsi:type="object">Magento\Framework\View\Element\UiComponent\DataProvider\RegularFilter</item>
<item name="fulltext" xsi:type="object">Magento\Framework\View\Element\UiComponent\DataProvider\FulltextFilter</item>
</argument>
</arguments>
</virtualType>
<virtualType name="SlideGridDataProvider" type="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider">
<arguments>
<argument name="collection" xsi:type="object" shared="false">Vendor\Company\Model\ResourceModel\Slide</argument>
<argument name="filterPool" xsi:type="object" shared="false">SlideGridFilterPool</argument>
</arguments>
</virtualType>
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
<item name="slide_data_source" xsi:type="string">Vendor\Company\Model\ResourceModel\Slide\Grid\Collection</item>
</argument>
</arguments>
</type>
<type name="Vendor\Company\Model\ResourceModel\Slide\Grid\Collection">
<arguments>
<argument name="mainTable" xsi:type="string">cartin24_respbannerslider</argument>
<argument name="eventPrefix" xsi:type="string">slide_collection</argument>
<argument name="eventObject" xsi:type="string">slide_collection</argument>
<argument name="resourceModel" xsi:type="string">Vendor\Company\Model\ResourceModel\Slide</argument>
</arguments>
</type>
</config>
But on upgrading the module(running the command) getting error as
" [InvalidArgumentException]
There are no commands defined in the "setup" namespace. "
Please help me with a solution.
I have displayed grid using ui component. Please see my app/code/Vendor/Company/view/adminhtml/ui_component/slide_list.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* @author Cartin24 Team
* @copyright Copyright (c) 2016 Cartin24 (http://www.cartin24.com)
* @package Cartin24_Respbannerslider
*/
-->
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="provider" xsi:type="string">slide_list.slidelist_data_source</item>
<item name="deps" xsi:type="string">slide_list.slidelist_data_source</item>
</item>
<item name="spinner" xsi:type="string">slide_columns</item>
</argument>
<dataSource name="slidelist_data_source">
<argument name="dataProvider" xsi:type="configurableObject">
<argument name="class" xsi:type="string">SlideGridDataProvider</argument>
<argument name="name" xsi:type="string">slidelist_data_source</argument>
<argument name="primaryFieldName" xsi:type="string">id</argument>
<argument name="requestFieldName" xsi:type="string">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 name="storageConfig" xsi:type="array">
<item name="indexField" xsi:type="string">id</item>
</item>
</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>
<container name="listing_top">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">ui/grid/toolbar</item>
</item>
</argument>
<bookmark name="bookmarks">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="storageConfig" xsi:type="array">
<item name="namespace" xsi:type="string">slide_list</item>
</item>
</item>
</argument>
</bookmark>
<component name="columns_controls">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/grid/controls/columns</item>
<item name="displayArea" xsi:type="string">dataGridActions</item>
<item name="columnsData" xsi:type="array">
<item name="provider" xsi:type="string">slide_list.slide_list.slide_columns</item>
</item>
</item>
</argument>
</component>
<filters name="listing_filters">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="columnsProvider" xsi:type="string">slide_list.slide_list.slide_columns</item>
<item name="storageConfig" xsi:type="array">
<item name="provider" xsi:type="string">slide_list.slide_list.listing_top.bookmarks</item>
<item name="namespace" xsi:type="string">current.filters</item>
</item>
<item name="templates" xsi:type="array">
<item name="filters" xsi:type="array">
<item name="select" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/form/element/ui-select</item>
<item name="template" xsi:type="string">ui/grid/filters/elements/ui-select</item>
</item>
</item>
</item>
<item name="childDefaults" xsi:type="array">
<item name="provider" xsi:type="string">slide_list.slide_list.slide_top.listing_filters</item>
<item name="imports" xsi:type="array">
<item name="visible" xsi:type="string">slide_list.slide_list.product_columns.${ $.index }:visible</item>
</item>
</item>
</item>
</argument>
</filters>
<!--
<massaction name="listing_massaction">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="selectProvider" xsi:type="string">slide_list.slide_list.slide_columns.ids</item>
<item name="indexField" xsi:type="string">id</item>
</item>
</argument>
<action name="approve">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="type" xsi:type="string">approve</item>
<item name="label" xsi:type="string" translate="true">Approve</item>
<item name="url" xsi:type="url" path="marketz/product/massApprove"/>
<item name="confirm" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Approve Product</item>
<item name="message" xsi:type="string" translate="true">Are you sure you wan't to approve selected products?</item>
</item>
</item>
</argument>
</action>
<action name="deny">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="type" xsi:type="string">deny</item>
<item name="label" xsi:type="string" translate="true">Deny</item>
<item name="url" xsi:type="url" path="marketz/product/massDeny"/>
<item name="confirm" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Deny items</item>
<item name="message" xsi:type="string" translate="true">Are you sure you wan't to deny selected products?</item>
</item>
</item>
</argument>
</action>
</massaction>
-->
<paging name="listing_paging">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="storageConfig" xsi:type="array">
<item name="provider" xsi:type="string">slide_list.slide_list.listing_top.bookmarks</item>
<item name="namespace" xsi:type="string">current.paging</item>
</item>
<item name="selectProvider" xsi:type="string">slide_list.slide_list.slide_columns.ids</item>
</item>
</argument>
</paging>
</container>
<columns name="slide_columns">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="storageConfig" xsi:type="array">
<item name="provider" xsi:type="string">slide_list.slide_list.slide_top.bookmarks</item>
<item name="namespace" xsi:type="string">current</item>
</item>
</item>
<item name="childDefaults" xsi:type="array">
<item name="fieldAction" xsi:type="array">
<item name="provider" xsi:type="string">slide_list.slide_list.slide_columns_editor</item>
<item name="target" xsi:type="string">startEdit</item>
<item name="params" xsi:type="array">
<item name="0" xsi:type="string">${ $.$data.rowIndex }</item>
<item name="1" xsi:type="boolean">true</item>
</item>
</item>
<item name="storageConfig" xsi:type="array">
<item name="provider" xsi:type="string">slide_list.slide_list.listing_top.bookmarks</item>
<item name="root" xsi:type="string">columns.${ $.index }</item>
<item name="namespace" xsi:type="string">current.${ $.storageConfig.root }</item>
</item>
</item>
</argument>
<selectionsColumn name="ids">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="indexField" xsi:type="string">id</item>
</item>
</argument>
</selectionsColumn>
<column name="title">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">textRange</item>
<item name="sorting" xsi:type="string">desc</item>
<item name="label" xsi:type="string" translate="true">Title</item>
</item>
</argument>
</column>
</columns>
</listing>