I have been trying to create a grid list for my custom module. All code part is done and the grid not displayed. Reviewed the code many times but I couldn’t find the issue.
Here is my code:
TestTestWorkflowControllerAdminhtmlDepartmentcodesDepartmentListing.php
<?php
namespace TestTestWorkflowControllerAdminhtmlDepartmentcodes;
class DepartmentListing extends MagentoBackendAppAction
{
protected $resultPageFactory = false;
public function __construct(
MagentoBackendAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory
){
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
}
public function execute()
{
$resultPage = $this->resultPageFactory->create();
$resultPage->getConfig()->getTitle()->prepend(__('Department Codes'));
return $resultPage;
}
}
TestTestWorkflowviewadminhtmllayoutpurchaseorder_departmentcodes_departmenlisting.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<uiComponent name="test"/>
</referenceContainer>
</body>
</page>
TestTestWorkflowviewadminhtmlui_componentstest.xml
<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">test.test_departmentlisting_data_source</item>
<item name="deps" xsi:type="string">test.test_departmentlisting_data_source</item>
</item>
<item name="spinner" xsi:type="string">spinner_columns</item>
<item name="buttons" xsi:type="array">
<item name="add" xsi:type="array">
<item name="name" xsi:type="string">add</item>
<item name="label" xsi:type="string" translate="true">Add</item>
<item name="class" xsi:type="string">primary</item>
<item name="url" xsi:type="string"></item>
</item>
</item>
</argument>
<dataSource name="test_departmentlisting_data_source">
<argument name="dataProvider" xsi:type="configurableObject">
<argument name="class" xsi:type="string">MagentoFrameworkViewElementUiComponentDataProviderDataProvider</argument>
<argument name="name" xsi:type="string">test_departmentlisting_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="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
<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>
</dataSource>
<columns name="spinner_columns">
<column name="id">
<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">asc</item>
<item name="label" xsi:type="string" translate="true">ID</item>
</item>
</argument>
</column>
<column name="code">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">text</item>
<item name="editor" xsi:type="array">
<item name="editorType" xsi:type="string">text</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
</item>
<item name="label" xsi:type="string" translate="true">Code</item>
</item>
</argument>
</column>
<column name="description">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">text</item>
<item name="editor" xsi:type="array">
<item name="editorType" xsi:type="string">text</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
</item>
<item name="label" xsi:type="string" translate="true">Description</item>
</item>
</argument>
</column>
<!-- <actionsColumn name="actions" class="TestTestOrderWorkflowUiComponentListingGridColumnDepartmentCodesAction">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="resizeEnabled" xsi:type="boolean">false</item>
<item name="resizeDefaultWidth" xsi:type="string">107</item>
<item name="indexField" xsi:type="string">id</item>
</item>
</argument>
</actionsColumn> -->
</columns>
</listing>
TestTestWorkflowetcdi.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<virtualType name="TestTestWorkflowModelResourceModelDepartmentCodesGridCollection">
<arguments>
<argument name="mainTable" xsi:type="string">test_dept_code</argument>
<argument name="resourceModel" xsi:type="string">TestTestWorkflowModelResourceModelDepartmentCodes</argument>
</arguments>
</virtualType>
<type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
<item name="test_departmentlisting_data_source" xsi:type="string">
TestTestWorkflowModelResourceModelDepartmentCodesGridCollection
</item>
</argument>
</arguments>
</type>
</config>