Skip to content

i am fetching the data from database and display in magento admin grid, and the grid display blank

I have tried all of my thinking, I don’t understand why the grid displays a blank

Controller

namespace StateDrivesRequestQuoteControllerAdminhtmlBulkquote;

use MagentoBackendAppAction;

use MagentoBackendAppActionContext;

use MagentoFrameworkViewResultPageFactory;

use StateDrivesRequestQuoteModelRequestQuoteFactory; 

use MagentoFrameworkRegistry;

class Index extends Action

{

protected $_resultPageFactory;
protected $_requestQuoteFactory;
protected $_registry;

public function __construct(
    Context $context,
    PageFactory $resultPageFactory,
    RequestQuoteFactory $requestQuoteFactory, 
    Registry $registry
) {
    parent::__construct($context);
    $this->_resultPageFactory = $resultPageFactory;
    $this->_requestQuoteFactory = $requestQuoteFactory;
    $this->_registry = $registry;
}

public function execute()
{
    $resultPage = $this->_resultPageFactory->create();
    $resultPage->getConfig()->getTitle()->prepend(__('Bulk Quotes'));

    return $resultPage;
}
protected function _isAllowed()
{
    return true;
}

}`

di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
      <virtualType name="RequestQuoteGridDataProvider" type="MagentoFrameworkViewElementUiComponentDataProviderDataProvider">
        <arguments>
            <argument name="collection" xsi:type="object" shared="false">StateDrivesRequestQuoteModelResourceModelRequestQuoteCollection</argument>
            <argument name="filterPool" xsi:type="object" shared="false">RequestQuoteGridFilterPool</argument>
        </arguments>
 </virtualType>
    
 <virtualType name="RequestQuoteGridFilterPool" type="MagentoFrameworkViewElementUiComponentDataProviderFilterPool">
        <arguments>
            <argument name="appliers" xsi:type="array">
                <item name="regular" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderRegularFilter</item>
                <item name="fulltext" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter</item>
            </argument>
        </arguments>
 </virtualType>

<type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
    <arguments>
        <argument name="collections" xsi:type="array">
            <item name="request_for_bulkquote_listing.request_for_bulkquote_listing_data_source" xsi:type="string">StateDrivesRequestQuoteModelResourceModelRequestQuoteCollection</item>
        </argument>
    </arguments>
</type>
<virtualType name="StateDrivesRequestQuoteModelResourceModelRequestQuoteCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
    <arguments>
        <argument name="mainTable" xsi:type="string">request_for_bulkquote</argument>
        <argument name="resourceModel" xsi:type="string">StateDrivesRequestQuoteModelResourceModelRequestQuote</argument>
    </arguments>
</virtualType>

menu.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
    <add id="StateDrives_RequestQuote::menu" title="Bulk Quote" module="StateDrives_RequestQuote" sortOrder="100" resource="StateDrives_RequestQuote::requestquote"/>
    <add id="StateDrives_RequestQuote::requestquote" title="Bulk Quote" module="StateDrives_RequestQuote" sortOrder="20" action="statesrives_requestquote/bulkquote/index" resource="StateDrives_RequestQuote::statesrives_requestquote_requestquote" parent="StateDrives_RequestQuote::menu"/>
</menu>

model

namespace StateDrivesRequestQuoteModel;

use MagentoFrameworkModelAbstractModel;

class RequestQuote extends AbstractModel
{
 protected function _construct()
 {
     $this- 
>_init('StateDrivesRequestQuoteModelResourceModelRequestQuote');
 }
}

ResourceModel

namespace StateDrivesRequestQuoteModelResourceModel;

use MagentoFrameworkModelResourceModelDbAbstractDb;

class RequestQuote extends AbstractDb
 {
public function __construct(
    MagentoFrameworkModelResourceModelDbContext $context
)
{
    parent::__construct($context);
}
protected function _construct()
{
    $this->_init('request_for_bulkquote', 'entity_id');
 }
}

ModelResourceModelRequestQuote

 namespace 
 StateDrivesRequestQuoteModelResourceModelRequestQuote;

  use 
  MagentoFrameworkModelResourceModelDbCollection 
  AbstractCollection;

class Collection extends AbstractCollection
  {
    protected $_idFieldName = 'entity_id';
    protected $_eventPrefix = 'request_for_bulkquote';

  protected function _construct()
 { 
    $this->_init(
        StateDrivesRequestQuoteModelRequestQuote::class
StateDrivesRequestQuoteModelResourceModelRequestQuote::class
    );
  }
}

view/adminhtml/layout

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="styles"/>
<body>
    <referenceContainer name="content">
        <uiComponent name="request_for_bulkquote_listing"/>
    </referenceContainer>
</body>

ui_component

<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd">
<argument name="data" xsi:type="array">
    <item name="js_config" xsi:type="array">
        <item name="provider" xsi:type="string">request_for_bulkquote_listing.request_for_bulkquote_listing_data_source</item>
        <item name="deps" xsi:type="string">request_for_bulkquote_listing.request_for_bulkquote_listing_data_source</item>
    </item>
    <item name="spinner" xsi:type="string">request_for_bulkquote_columns</item>
</argument>
<dataSource name="request_for_bulkquote_listing_data_source">
    <argument name="dataProvider" xsi:type="configurableObject">
        <argument name="class" xsi:type="string">StateDrivesRequestQuoteModelResourceModelRequestQuoteGridCollection</argument>
        <argument name="name" xsi:type="string">request_for_bulkquote_listing_data_source</argument>
        <argument name="primaryFieldName" xsi:type="string">entity_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>
        </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">request_for_bulkquote_listing</item>
                </item>
            </item>
        </argument>
    </bookmark>
    <component name="columns_controls">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="columnsData" xsi:type="array">
                    <item name="provider" xsi:type="string">request_for_bulkquote_listing.request_for_bulkquote_listing.request_for_bulkquote_columns</item>
                </item>
                <item name="component" xsi:type="string">Magento_Ui/js/grid/controls/columns</item>
                <item name="displayArea" xsi:type="string">dataGridActions</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">request_for_bulkquote_listing.request_for_bulkquote_listing.request_for_bulkquote_columns</item>
                <item name="storageConfig" xsi:type="array">
                    <item name="provider" xsi:type="string">request_for_bulkquote_listing.request_for_bulkquote_listing.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">request_for_bulkquote_listing.request_for_bulkquote_listing.listing_top.listing_filters</item>
                </item>
            </item>
        </argument>
    </filters>
    <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">request_for_bulkquote_listing.request_for_bulkquote_listing.listing_top.bookmarks</item>
                    <item name="namespace" xsi:type="string">current.paging</item>
                </item>
                <item name="selectProvider" xsi:type="string">request_for_bulkquote_listing.request_for_bulkquote_listing.request_for_bulkquote_columns.ids</item>
            </item>
        </argument>
    </paging>
</container>
<columns name="request_for_bulkquote_columns" class ="MagentoUiComponentListingColumns">
    <column name="entity_id">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="filter" xsi:type="string">textRange</item>
                <item name="label" xsi:type="string" translate="true">ENTITY ID</item>
            </item>
        </argument>
    </column>
    <column name="full_name" >
        <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">FULL NAME</item>
            </item>
        </argument>
    </column>
    <column name="email" >
        <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">EMAIL</item>
            </item>
        </argument>
    </column>
    <column name="phone" >
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
            <item name="filter" xsi:type="string">textRange</item>
            <item name="label" xsi:type="string" translate="true">PHONE</item>
            </item>
        </argument>
    </column>
    <column name="quantity" >
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
            <item name="filter" xsi:type="string">textRange</item>
            <item name="label" xsi:type="string" translate="true">QUANTITY</item>
            </item>
        </argument>
    </column>
    <column name="how_soon_do_you_need_it" >
        <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">How soon do you need it</item>
            </item>
        </argument>
    </column>
    <column name="company_name" >
        <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">COMPANY NAME</item>
            </item>
        </argument>
    </column>
</columns>

db_schema.xml

<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="request_for_bulkquote" resource="default" engine="innodb" comment="State Drives Request Quote Table">
    <column xsi:type="int" name="entity_id" unsigned="true" nullable="false" identity="true" comment="Entity ID"/>
    <column xsi:type="text" name="full_name" nullable="false" comment="Full Name"/>
    <column xsi:type="text" name="email" nullable="false" comment="Email"/>
    <column xsi:type="text" name="phone" nullable="false" comment="Phone"/>
    <column xsi:type="int" name="quantity" nullable="false" comment="Quantity"/>
    <column xsi:type="varchar" name="how_soon_do_you_need_it" comment="How soon do you need it"/>
    <column xsi:type="text" name="company_name" nullable="true" comment="Company Name"/>
    <constraint xsi:type="primary" referenceId="PRIMARY">
        <column name="entity_id"/>
    </constraint>
</table>

enter image description here
please help me to get out of this,I will be thankful to you