Magento 2.3.0 While edit UI component form data not filled up in custom module












0














I have created a custom module using UI component form and i am facing issue while edit form data is not showing.



Below is UI form code with given path.




/app/code/Namespace/Modulename/view/adminhtml/ui_component/managelabels_productlabel_form.xml




<?xml version="1.0" ?>
<form 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">managelabels_productlabel_form.managelabels_productlabel_form_data_source</item>
<!-- <item name="deps" xsi:type="string">managelabels_productlabel_form.managelabels_productlabel_form_data_source</item>-->
</item>
<item name="label" translate="true" xsi:type="string">Label Options</item>
<item name="config" xsi:type="array">
<item name="dataScope" xsi:type="string">data</item>
<item name="namespace" xsi:type="string">managelabels_productlabel_form</item>
</item>
<item name="reverseMetadataMerge" xsi:type="boolean">true</item>
</argument>
<settings>
<buttons>
<button class="NamespaceModulenameBlockAdminhtmlProductlabelEditBackButton" name="back"/>
<button class="NamespaceModulenameBlockAdminhtmlProductlabelEditDeleteButton" name="delete"/>
<button class="NamespaceModulenameBlockAdminhtmlProductlabelEditSaveButton" name="save"/>
<button class="NamespaceModulenameBlockAdminhtmlProductlabelEditSaveAndContinueButton" name="save_and_continue"/>
</buttons>
<layout>
<navContainerName>left</navContainerName>
<type>tabs</type>
</layout>
<deps>
<dep>managelabels_productlabel_form.managelabels_productlabel_form_data_source</dep>
</deps>
</settings>
<dataSource name="managelabels_productlabel_form_data_source">
<argument name="dataProvider" xsi:type="configurableObject">
<argument name="class" xsi:type="string">NamespaceModulenameModelProductlabelDataProvider</argument>
<argument name="name" xsi:type="string">managelabels_productlabel_form_data_source</argument>
<argument name="primaryFieldName" xsi:type="string">productlabel_id</argument>
<argument name="requestFieldName" xsi:type="string">id</argument>
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="submit_url" xsi:type="url" path="managelabels/productlabel/save"/>
</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/form/provider</item>
</item>
</argument>
</dataSource>
<fieldset name="general">
<settings>
<label translate="true">General Info</label>
</settings>
<field name="productlabel_id">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="visible" xsi:type="boolean">false</item>
<item name="dataType" xsi:type="string">text</item>
<item name="label" xsi:type="string" translate="true">Productlabel ID</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">data</item>
<item name="dataScope" xsi:type="string">productlabel_id</item>
</item>
</argument>
</field>
<field name="labelname" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">labelname</item>
</item>
</argument>
<settings>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
</validation>
<dataType>text</dataType>
<label translate="true">Label Name</label>
</settings>
</field>
<field name="is_active" sortOrder="10" formElement="checkbox">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">status</item>
<item name="default" xsi:type="number">1</item>
</item>
</argument>
<settings>
<dataType>boolean</dataType>
<label translate="true">Status</label>
<dataScope>status</dataScope>
</settings>
<formElements>
<checkbox>
<settings>
<valueMap>
<map name="false" xsi:type="number">0</map>
<map name="true" xsi:type="number">1</map>
</valueMap>
<prefer>toggle</prefer>
</settings>
</checkbox>
</formElements>
</field>
<field name="priority" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">priority</item>
<item name="notice" xsi:type="string" translate="true">Use 0 to show label first, and 99 to show it last</item>
</item>
</argument>
<settings>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
</validation>
<dataType>text</dataType>
<label translate="true">Priority</label>
</settings>
</field>
<field name="start_date">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">string</item>
<item name="label" xsi:type="string" translate="true">Start Date</item>
<item name="formElement" xsi:type="string">date</item>
<item name="source" xsi:type="string">page</item>
<item name="sortOrder" xsi:type="number">21</item>
<item name="dataScope" xsi:type="string">start_date</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
<item name="options" xsi:type="array">
<item name="dateFormat" xsi:type="string">yyyy-MM-dd</item>
<item name="timeFormat" xsi:type="string">HH:mm:ss</item>
<item name="showsTime" xsi:type="boolean">true</item>
</item>
</item>
</argument>
</field>
<field name="end_date">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">string</item>
<item name="label" xsi:type="string" translate="true">Start Date</item>
<item name="formElement" xsi:type="string">date</item>
<item name="source" xsi:type="string">page</item>
<item name="sortOrder" xsi:type="number">21</item>
<item name="dataScope" xsi:type="string">end_date</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
<item name="options" xsi:type="array">
<item name="dateFormat" xsi:type="string">yyyy-MM-dd</item>
<item name="timeFormat" xsi:type="string">HH:mm:ss</item>
<item name="showsTime" xsi:type="boolean">true</item>
</item>
</item>
</argument>
</field>
</fieldset>
<fieldset name="labelconfig">
<settings>
<label translate="true">Label Configuration</label>
</settings>
<field name="image">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">string</item>
<item name="source" xsi:type="string">image</item>
<item name="label" xsi:type="string" translate="true">Image</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="formElement" xsi:type="string">fileUploader</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
<item name="previewTmpl" xsi:type="string">Namespace_Modulename/image-preview</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
<item name="uploaderConfig" xsi:type="array">
<item name="url" xsi:type="url" path="managelabels/productlabel/upload"/>
</item>
</item>
</argument>
</field>
<field name="image_data" sortOrder="20" formElement="hidden">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">image</item>
</item>
</argument>
<settings>
<dataType>text</dataType>
<label translate="true">Image Data</label>
<dataScope>image_data</dataScope>
</settings>
</field>
<field name="label_text" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">label_text</item>
</item>
</argument>
<settings>
<dataType>text</dataType>
<label translate="true">Label Text</label>
</settings>
</field>
<field name="label_text_data" sortOrder="20" formElement="hidden">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">image</item>
</item>
</argument>
<settings>
<dataType>text</dataType>
<label translate="true">Label Text Data</label>
<dataScope>label_text_data</dataScope>
</settings>
</field>
</fieldset>
<fieldset name="condition">
<settings>
<label translate="true">Condition</label>
</settings>
<field name="store_ids">
<argument name="data" xsi:type="array">
<item name="options" xsi:type="object">MagentoCmsUiComponentListingColumnCmsOptions</item>
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">int</item>
<item name="label" xsi:type="string" translate="true">Store View</item>
<item name="formElement" xsi:type="string">multiselect</item>
<item name="source" xsi:type="string">page</item>
<item name="dataScope" xsi:type="string">store_ids</item>
<item name="default" xsi:type="string">0</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
</item>
</argument>
</field>
<field name="customers_group_ids">
<argument name="data" xsi:type="array">
<item name="options" xsi:type="object">MagentoCmsUiComponentListingColumnCmsOptions</item>
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Customer Groups</item>
<item name="dataType" xsi:type="string">number</item>
<item name="formElement" xsi:type="string">multiselect</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
<item name="source" xsi:type="string">Namespace_Modulename</item>
<item name="dataScope" xsi:type="string">customers_group_ids</item>
</item>
</argument>
</field>
<container name="conditions_apply_to" sortOrder="10">
<htmlContent name="html_content">
<block name="conditions_apply_to" class="NamespaceModulenameBlockAdminhtmlProductlabelEditTabConditions" />
</htmlContent>
</container>
</fieldset>
</form>


Below is UI dataprovider with given path.




/app/code/Namespace/Modulename/Model/Productlabel/DataProvider.php




<?php

namespace NamespaceModulenameModelProductlabel;

use MagentoFrameworkAppRequestDataPersistorInterface;
use MagentoUiDataProviderAbstractDataProvider;
use NamespaceModulenameModelResourceModelProductlabelCollectionFactory;

class DataProvider extends AbstractDataProvider
{
/**
* @var ResourceModelDataCollection
*/
protected $collection;

/**
* @var DataPersistorInterface
*/
protected $dataPersistor;

/**
* @var array
*/
protected $loadedData;

/**
* @param string $name
* @param string $primaryFieldName
* @param string $requestFieldName
* @param CollectionFactory $pageCollectionFactory
* @param DataPersistorInterface $dataPersistor
* @param array $meta
* @param array $data
*/
public function __construct(
$name,
$primaryFieldName,
$requestFieldName,
CollectionFactory $pageCollectionFactory,
DataPersistorInterface $dataPersistor,
array $meta = ,
array $data =
) {
$this->collection = $pageCollectionFactory->create();
$this->dataPersistor = $dataPersistor;
$this->meta = $this->prepareMeta($this->meta);
parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
}

/**
* Prepares Meta
*
* @param array $meta
* @return array
*/
public function prepareMeta(array $meta)
{
return $meta;
}

/**
* Get data
*
* @return array
*/
public function getData()
{
if (isset($this->loadedData)) {
return $this->loadedData;
}
$items = $this->collection->getItems();
$ruleId = '';
foreach ($items as $page) {
$this->loadedData[$page->getId()] = $page->getData();
$ruleId = $page->getId();
}
$data = $this->dataPersistor->get('module_messages');
if (!empty($data)) {
$page = $this->collection->getNewEmptyItem();
$page->setData($data);
$this->loadedData[$page->getId()] = $page->getData();
$this->dataPersistor->clear('module_messages');
}

return $this->loadedData;
}
}


There is something is missing or wrong in above code but i can't find out what is it.



I try a lots but no luck to solved out problem. can anyone help me?



Any help would be appreciated! Thanks.










share|improve this question





























    0














    I have created a custom module using UI component form and i am facing issue while edit form data is not showing.



    Below is UI form code with given path.




    /app/code/Namespace/Modulename/view/adminhtml/ui_component/managelabels_productlabel_form.xml




    <?xml version="1.0" ?>
    <form 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">managelabels_productlabel_form.managelabels_productlabel_form_data_source</item>
    <!-- <item name="deps" xsi:type="string">managelabels_productlabel_form.managelabels_productlabel_form_data_source</item>-->
    </item>
    <item name="label" translate="true" xsi:type="string">Label Options</item>
    <item name="config" xsi:type="array">
    <item name="dataScope" xsi:type="string">data</item>
    <item name="namespace" xsi:type="string">managelabels_productlabel_form</item>
    </item>
    <item name="reverseMetadataMerge" xsi:type="boolean">true</item>
    </argument>
    <settings>
    <buttons>
    <button class="NamespaceModulenameBlockAdminhtmlProductlabelEditBackButton" name="back"/>
    <button class="NamespaceModulenameBlockAdminhtmlProductlabelEditDeleteButton" name="delete"/>
    <button class="NamespaceModulenameBlockAdminhtmlProductlabelEditSaveButton" name="save"/>
    <button class="NamespaceModulenameBlockAdminhtmlProductlabelEditSaveAndContinueButton" name="save_and_continue"/>
    </buttons>
    <layout>
    <navContainerName>left</navContainerName>
    <type>tabs</type>
    </layout>
    <deps>
    <dep>managelabels_productlabel_form.managelabels_productlabel_form_data_source</dep>
    </deps>
    </settings>
    <dataSource name="managelabels_productlabel_form_data_source">
    <argument name="dataProvider" xsi:type="configurableObject">
    <argument name="class" xsi:type="string">NamespaceModulenameModelProductlabelDataProvider</argument>
    <argument name="name" xsi:type="string">managelabels_productlabel_form_data_source</argument>
    <argument name="primaryFieldName" xsi:type="string">productlabel_id</argument>
    <argument name="requestFieldName" xsi:type="string">id</argument>
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="submit_url" xsi:type="url" path="managelabels/productlabel/save"/>
    </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/form/provider</item>
    </item>
    </argument>
    </dataSource>
    <fieldset name="general">
    <settings>
    <label translate="true">General Info</label>
    </settings>
    <field name="productlabel_id">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="visible" xsi:type="boolean">false</item>
    <item name="dataType" xsi:type="string">text</item>
    <item name="label" xsi:type="string" translate="true">Productlabel ID</item>
    <item name="formElement" xsi:type="string">input</item>
    <item name="source" xsi:type="string">data</item>
    <item name="dataScope" xsi:type="string">productlabel_id</item>
    </item>
    </argument>
    </field>
    <field name="labelname" formElement="input">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="source" xsi:type="string">labelname</item>
    </item>
    </argument>
    <settings>
    <validation>
    <rule name="required-entry" xsi:type="boolean">true</rule>
    </validation>
    <dataType>text</dataType>
    <label translate="true">Label Name</label>
    </settings>
    </field>
    <field name="is_active" sortOrder="10" formElement="checkbox">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="source" xsi:type="string">status</item>
    <item name="default" xsi:type="number">1</item>
    </item>
    </argument>
    <settings>
    <dataType>boolean</dataType>
    <label translate="true">Status</label>
    <dataScope>status</dataScope>
    </settings>
    <formElements>
    <checkbox>
    <settings>
    <valueMap>
    <map name="false" xsi:type="number">0</map>
    <map name="true" xsi:type="number">1</map>
    </valueMap>
    <prefer>toggle</prefer>
    </settings>
    </checkbox>
    </formElements>
    </field>
    <field name="priority" formElement="input">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="source" xsi:type="string">priority</item>
    <item name="notice" xsi:type="string" translate="true">Use 0 to show label first, and 99 to show it last</item>
    </item>
    </argument>
    <settings>
    <validation>
    <rule name="required-entry" xsi:type="boolean">true</rule>
    </validation>
    <dataType>text</dataType>
    <label translate="true">Priority</label>
    </settings>
    </field>
    <field name="start_date">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="dataType" xsi:type="string">string</item>
    <item name="label" xsi:type="string" translate="true">Start Date</item>
    <item name="formElement" xsi:type="string">date</item>
    <item name="source" xsi:type="string">page</item>
    <item name="sortOrder" xsi:type="number">21</item>
    <item name="dataScope" xsi:type="string">start_date</item>
    <item name="validation" xsi:type="array">
    <item name="required-entry" xsi:type="boolean">true</item>
    </item>
    <item name="options" xsi:type="array">
    <item name="dateFormat" xsi:type="string">yyyy-MM-dd</item>
    <item name="timeFormat" xsi:type="string">HH:mm:ss</item>
    <item name="showsTime" xsi:type="boolean">true</item>
    </item>
    </item>
    </argument>
    </field>
    <field name="end_date">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="dataType" xsi:type="string">string</item>
    <item name="label" xsi:type="string" translate="true">Start Date</item>
    <item name="formElement" xsi:type="string">date</item>
    <item name="source" xsi:type="string">page</item>
    <item name="sortOrder" xsi:type="number">21</item>
    <item name="dataScope" xsi:type="string">end_date</item>
    <item name="validation" xsi:type="array">
    <item name="required-entry" xsi:type="boolean">true</item>
    </item>
    <item name="options" xsi:type="array">
    <item name="dateFormat" xsi:type="string">yyyy-MM-dd</item>
    <item name="timeFormat" xsi:type="string">HH:mm:ss</item>
    <item name="showsTime" xsi:type="boolean">true</item>
    </item>
    </item>
    </argument>
    </field>
    </fieldset>
    <fieldset name="labelconfig">
    <settings>
    <label translate="true">Label Configuration</label>
    </settings>
    <field name="image">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="dataType" xsi:type="string">string</item>
    <item name="source" xsi:type="string">image</item>
    <item name="label" xsi:type="string" translate="true">Image</item>
    <item name="visible" xsi:type="boolean">true</item>
    <item name="formElement" xsi:type="string">fileUploader</item>
    <item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
    <item name="previewTmpl" xsi:type="string">Namespace_Modulename/image-preview</item>
    <item name="validation" xsi:type="array">
    <item name="required-entry" xsi:type="boolean">true</item>
    </item>
    <item name="uploaderConfig" xsi:type="array">
    <item name="url" xsi:type="url" path="managelabels/productlabel/upload"/>
    </item>
    </item>
    </argument>
    </field>
    <field name="image_data" sortOrder="20" formElement="hidden">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="source" xsi:type="string">image</item>
    </item>
    </argument>
    <settings>
    <dataType>text</dataType>
    <label translate="true">Image Data</label>
    <dataScope>image_data</dataScope>
    </settings>
    </field>
    <field name="label_text" formElement="input">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="source" xsi:type="string">label_text</item>
    </item>
    </argument>
    <settings>
    <dataType>text</dataType>
    <label translate="true">Label Text</label>
    </settings>
    </field>
    <field name="label_text_data" sortOrder="20" formElement="hidden">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="source" xsi:type="string">image</item>
    </item>
    </argument>
    <settings>
    <dataType>text</dataType>
    <label translate="true">Label Text Data</label>
    <dataScope>label_text_data</dataScope>
    </settings>
    </field>
    </fieldset>
    <fieldset name="condition">
    <settings>
    <label translate="true">Condition</label>
    </settings>
    <field name="store_ids">
    <argument name="data" xsi:type="array">
    <item name="options" xsi:type="object">MagentoCmsUiComponentListingColumnCmsOptions</item>
    <item name="config" xsi:type="array">
    <item name="dataType" xsi:type="string">int</item>
    <item name="label" xsi:type="string" translate="true">Store View</item>
    <item name="formElement" xsi:type="string">multiselect</item>
    <item name="source" xsi:type="string">page</item>
    <item name="dataScope" xsi:type="string">store_ids</item>
    <item name="default" xsi:type="string">0</item>
    <item name="validation" xsi:type="array">
    <item name="required-entry" xsi:type="boolean">true</item>
    </item>
    </item>
    </argument>
    </field>
    <field name="customers_group_ids">
    <argument name="data" xsi:type="array">
    <item name="options" xsi:type="object">MagentoCmsUiComponentListingColumnCmsOptions</item>
    <item name="config" xsi:type="array">
    <item name="label" xsi:type="string" translate="true">Customer Groups</item>
    <item name="dataType" xsi:type="string">number</item>
    <item name="formElement" xsi:type="string">multiselect</item>
    <item name="validation" xsi:type="array">
    <item name="required-entry" xsi:type="boolean">true</item>
    </item>
    <item name="source" xsi:type="string">Namespace_Modulename</item>
    <item name="dataScope" xsi:type="string">customers_group_ids</item>
    </item>
    </argument>
    </field>
    <container name="conditions_apply_to" sortOrder="10">
    <htmlContent name="html_content">
    <block name="conditions_apply_to" class="NamespaceModulenameBlockAdminhtmlProductlabelEditTabConditions" />
    </htmlContent>
    </container>
    </fieldset>
    </form>


    Below is UI dataprovider with given path.




    /app/code/Namespace/Modulename/Model/Productlabel/DataProvider.php




    <?php

    namespace NamespaceModulenameModelProductlabel;

    use MagentoFrameworkAppRequestDataPersistorInterface;
    use MagentoUiDataProviderAbstractDataProvider;
    use NamespaceModulenameModelResourceModelProductlabelCollectionFactory;

    class DataProvider extends AbstractDataProvider
    {
    /**
    * @var ResourceModelDataCollection
    */
    protected $collection;

    /**
    * @var DataPersistorInterface
    */
    protected $dataPersistor;

    /**
    * @var array
    */
    protected $loadedData;

    /**
    * @param string $name
    * @param string $primaryFieldName
    * @param string $requestFieldName
    * @param CollectionFactory $pageCollectionFactory
    * @param DataPersistorInterface $dataPersistor
    * @param array $meta
    * @param array $data
    */
    public function __construct(
    $name,
    $primaryFieldName,
    $requestFieldName,
    CollectionFactory $pageCollectionFactory,
    DataPersistorInterface $dataPersistor,
    array $meta = ,
    array $data =
    ) {
    $this->collection = $pageCollectionFactory->create();
    $this->dataPersistor = $dataPersistor;
    $this->meta = $this->prepareMeta($this->meta);
    parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
    }

    /**
    * Prepares Meta
    *
    * @param array $meta
    * @return array
    */
    public function prepareMeta(array $meta)
    {
    return $meta;
    }

    /**
    * Get data
    *
    * @return array
    */
    public function getData()
    {
    if (isset($this->loadedData)) {
    return $this->loadedData;
    }
    $items = $this->collection->getItems();
    $ruleId = '';
    foreach ($items as $page) {
    $this->loadedData[$page->getId()] = $page->getData();
    $ruleId = $page->getId();
    }
    $data = $this->dataPersistor->get('module_messages');
    if (!empty($data)) {
    $page = $this->collection->getNewEmptyItem();
    $page->setData($data);
    $this->loadedData[$page->getId()] = $page->getData();
    $this->dataPersistor->clear('module_messages');
    }

    return $this->loadedData;
    }
    }


    There is something is missing or wrong in above code but i can't find out what is it.



    I try a lots but no luck to solved out problem. can anyone help me?



    Any help would be appreciated! Thanks.










    share|improve this question



























      0












      0








      0







      I have created a custom module using UI component form and i am facing issue while edit form data is not showing.



      Below is UI form code with given path.




      /app/code/Namespace/Modulename/view/adminhtml/ui_component/managelabels_productlabel_form.xml




      <?xml version="1.0" ?>
      <form 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">managelabels_productlabel_form.managelabels_productlabel_form_data_source</item>
      <!-- <item name="deps" xsi:type="string">managelabels_productlabel_form.managelabels_productlabel_form_data_source</item>-->
      </item>
      <item name="label" translate="true" xsi:type="string">Label Options</item>
      <item name="config" xsi:type="array">
      <item name="dataScope" xsi:type="string">data</item>
      <item name="namespace" xsi:type="string">managelabels_productlabel_form</item>
      </item>
      <item name="reverseMetadataMerge" xsi:type="boolean">true</item>
      </argument>
      <settings>
      <buttons>
      <button class="NamespaceModulenameBlockAdminhtmlProductlabelEditBackButton" name="back"/>
      <button class="NamespaceModulenameBlockAdminhtmlProductlabelEditDeleteButton" name="delete"/>
      <button class="NamespaceModulenameBlockAdminhtmlProductlabelEditSaveButton" name="save"/>
      <button class="NamespaceModulenameBlockAdminhtmlProductlabelEditSaveAndContinueButton" name="save_and_continue"/>
      </buttons>
      <layout>
      <navContainerName>left</navContainerName>
      <type>tabs</type>
      </layout>
      <deps>
      <dep>managelabels_productlabel_form.managelabels_productlabel_form_data_source</dep>
      </deps>
      </settings>
      <dataSource name="managelabels_productlabel_form_data_source">
      <argument name="dataProvider" xsi:type="configurableObject">
      <argument name="class" xsi:type="string">NamespaceModulenameModelProductlabelDataProvider</argument>
      <argument name="name" xsi:type="string">managelabels_productlabel_form_data_source</argument>
      <argument name="primaryFieldName" xsi:type="string">productlabel_id</argument>
      <argument name="requestFieldName" xsi:type="string">id</argument>
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="submit_url" xsi:type="url" path="managelabels/productlabel/save"/>
      </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/form/provider</item>
      </item>
      </argument>
      </dataSource>
      <fieldset name="general">
      <settings>
      <label translate="true">General Info</label>
      </settings>
      <field name="productlabel_id">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="visible" xsi:type="boolean">false</item>
      <item name="dataType" xsi:type="string">text</item>
      <item name="label" xsi:type="string" translate="true">Productlabel ID</item>
      <item name="formElement" xsi:type="string">input</item>
      <item name="source" xsi:type="string">data</item>
      <item name="dataScope" xsi:type="string">productlabel_id</item>
      </item>
      </argument>
      </field>
      <field name="labelname" formElement="input">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="source" xsi:type="string">labelname</item>
      </item>
      </argument>
      <settings>
      <validation>
      <rule name="required-entry" xsi:type="boolean">true</rule>
      </validation>
      <dataType>text</dataType>
      <label translate="true">Label Name</label>
      </settings>
      </field>
      <field name="is_active" sortOrder="10" formElement="checkbox">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="source" xsi:type="string">status</item>
      <item name="default" xsi:type="number">1</item>
      </item>
      </argument>
      <settings>
      <dataType>boolean</dataType>
      <label translate="true">Status</label>
      <dataScope>status</dataScope>
      </settings>
      <formElements>
      <checkbox>
      <settings>
      <valueMap>
      <map name="false" xsi:type="number">0</map>
      <map name="true" xsi:type="number">1</map>
      </valueMap>
      <prefer>toggle</prefer>
      </settings>
      </checkbox>
      </formElements>
      </field>
      <field name="priority" formElement="input">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="source" xsi:type="string">priority</item>
      <item name="notice" xsi:type="string" translate="true">Use 0 to show label first, and 99 to show it last</item>
      </item>
      </argument>
      <settings>
      <validation>
      <rule name="required-entry" xsi:type="boolean">true</rule>
      </validation>
      <dataType>text</dataType>
      <label translate="true">Priority</label>
      </settings>
      </field>
      <field name="start_date">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="dataType" xsi:type="string">string</item>
      <item name="label" xsi:type="string" translate="true">Start Date</item>
      <item name="formElement" xsi:type="string">date</item>
      <item name="source" xsi:type="string">page</item>
      <item name="sortOrder" xsi:type="number">21</item>
      <item name="dataScope" xsi:type="string">start_date</item>
      <item name="validation" xsi:type="array">
      <item name="required-entry" xsi:type="boolean">true</item>
      </item>
      <item name="options" xsi:type="array">
      <item name="dateFormat" xsi:type="string">yyyy-MM-dd</item>
      <item name="timeFormat" xsi:type="string">HH:mm:ss</item>
      <item name="showsTime" xsi:type="boolean">true</item>
      </item>
      </item>
      </argument>
      </field>
      <field name="end_date">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="dataType" xsi:type="string">string</item>
      <item name="label" xsi:type="string" translate="true">Start Date</item>
      <item name="formElement" xsi:type="string">date</item>
      <item name="source" xsi:type="string">page</item>
      <item name="sortOrder" xsi:type="number">21</item>
      <item name="dataScope" xsi:type="string">end_date</item>
      <item name="validation" xsi:type="array">
      <item name="required-entry" xsi:type="boolean">true</item>
      </item>
      <item name="options" xsi:type="array">
      <item name="dateFormat" xsi:type="string">yyyy-MM-dd</item>
      <item name="timeFormat" xsi:type="string">HH:mm:ss</item>
      <item name="showsTime" xsi:type="boolean">true</item>
      </item>
      </item>
      </argument>
      </field>
      </fieldset>
      <fieldset name="labelconfig">
      <settings>
      <label translate="true">Label Configuration</label>
      </settings>
      <field name="image">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="dataType" xsi:type="string">string</item>
      <item name="source" xsi:type="string">image</item>
      <item name="label" xsi:type="string" translate="true">Image</item>
      <item name="visible" xsi:type="boolean">true</item>
      <item name="formElement" xsi:type="string">fileUploader</item>
      <item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
      <item name="previewTmpl" xsi:type="string">Namespace_Modulename/image-preview</item>
      <item name="validation" xsi:type="array">
      <item name="required-entry" xsi:type="boolean">true</item>
      </item>
      <item name="uploaderConfig" xsi:type="array">
      <item name="url" xsi:type="url" path="managelabels/productlabel/upload"/>
      </item>
      </item>
      </argument>
      </field>
      <field name="image_data" sortOrder="20" formElement="hidden">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="source" xsi:type="string">image</item>
      </item>
      </argument>
      <settings>
      <dataType>text</dataType>
      <label translate="true">Image Data</label>
      <dataScope>image_data</dataScope>
      </settings>
      </field>
      <field name="label_text" formElement="input">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="source" xsi:type="string">label_text</item>
      </item>
      </argument>
      <settings>
      <dataType>text</dataType>
      <label translate="true">Label Text</label>
      </settings>
      </field>
      <field name="label_text_data" sortOrder="20" formElement="hidden">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="source" xsi:type="string">image</item>
      </item>
      </argument>
      <settings>
      <dataType>text</dataType>
      <label translate="true">Label Text Data</label>
      <dataScope>label_text_data</dataScope>
      </settings>
      </field>
      </fieldset>
      <fieldset name="condition">
      <settings>
      <label translate="true">Condition</label>
      </settings>
      <field name="store_ids">
      <argument name="data" xsi:type="array">
      <item name="options" xsi:type="object">MagentoCmsUiComponentListingColumnCmsOptions</item>
      <item name="config" xsi:type="array">
      <item name="dataType" xsi:type="string">int</item>
      <item name="label" xsi:type="string" translate="true">Store View</item>
      <item name="formElement" xsi:type="string">multiselect</item>
      <item name="source" xsi:type="string">page</item>
      <item name="dataScope" xsi:type="string">store_ids</item>
      <item name="default" xsi:type="string">0</item>
      <item name="validation" xsi:type="array">
      <item name="required-entry" xsi:type="boolean">true</item>
      </item>
      </item>
      </argument>
      </field>
      <field name="customers_group_ids">
      <argument name="data" xsi:type="array">
      <item name="options" xsi:type="object">MagentoCmsUiComponentListingColumnCmsOptions</item>
      <item name="config" xsi:type="array">
      <item name="label" xsi:type="string" translate="true">Customer Groups</item>
      <item name="dataType" xsi:type="string">number</item>
      <item name="formElement" xsi:type="string">multiselect</item>
      <item name="validation" xsi:type="array">
      <item name="required-entry" xsi:type="boolean">true</item>
      </item>
      <item name="source" xsi:type="string">Namespace_Modulename</item>
      <item name="dataScope" xsi:type="string">customers_group_ids</item>
      </item>
      </argument>
      </field>
      <container name="conditions_apply_to" sortOrder="10">
      <htmlContent name="html_content">
      <block name="conditions_apply_to" class="NamespaceModulenameBlockAdminhtmlProductlabelEditTabConditions" />
      </htmlContent>
      </container>
      </fieldset>
      </form>


      Below is UI dataprovider with given path.




      /app/code/Namespace/Modulename/Model/Productlabel/DataProvider.php




      <?php

      namespace NamespaceModulenameModelProductlabel;

      use MagentoFrameworkAppRequestDataPersistorInterface;
      use MagentoUiDataProviderAbstractDataProvider;
      use NamespaceModulenameModelResourceModelProductlabelCollectionFactory;

      class DataProvider extends AbstractDataProvider
      {
      /**
      * @var ResourceModelDataCollection
      */
      protected $collection;

      /**
      * @var DataPersistorInterface
      */
      protected $dataPersistor;

      /**
      * @var array
      */
      protected $loadedData;

      /**
      * @param string $name
      * @param string $primaryFieldName
      * @param string $requestFieldName
      * @param CollectionFactory $pageCollectionFactory
      * @param DataPersistorInterface $dataPersistor
      * @param array $meta
      * @param array $data
      */
      public function __construct(
      $name,
      $primaryFieldName,
      $requestFieldName,
      CollectionFactory $pageCollectionFactory,
      DataPersistorInterface $dataPersistor,
      array $meta = ,
      array $data =
      ) {
      $this->collection = $pageCollectionFactory->create();
      $this->dataPersistor = $dataPersistor;
      $this->meta = $this->prepareMeta($this->meta);
      parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
      }

      /**
      * Prepares Meta
      *
      * @param array $meta
      * @return array
      */
      public function prepareMeta(array $meta)
      {
      return $meta;
      }

      /**
      * Get data
      *
      * @return array
      */
      public function getData()
      {
      if (isset($this->loadedData)) {
      return $this->loadedData;
      }
      $items = $this->collection->getItems();
      $ruleId = '';
      foreach ($items as $page) {
      $this->loadedData[$page->getId()] = $page->getData();
      $ruleId = $page->getId();
      }
      $data = $this->dataPersistor->get('module_messages');
      if (!empty($data)) {
      $page = $this->collection->getNewEmptyItem();
      $page->setData($data);
      $this->loadedData[$page->getId()] = $page->getData();
      $this->dataPersistor->clear('module_messages');
      }

      return $this->loadedData;
      }
      }


      There is something is missing or wrong in above code but i can't find out what is it.



      I try a lots but no luck to solved out problem. can anyone help me?



      Any help would be appreciated! Thanks.










      share|improve this question















      I have created a custom module using UI component form and i am facing issue while edit form data is not showing.



      Below is UI form code with given path.




      /app/code/Namespace/Modulename/view/adminhtml/ui_component/managelabels_productlabel_form.xml




      <?xml version="1.0" ?>
      <form 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">managelabels_productlabel_form.managelabels_productlabel_form_data_source</item>
      <!-- <item name="deps" xsi:type="string">managelabels_productlabel_form.managelabels_productlabel_form_data_source</item>-->
      </item>
      <item name="label" translate="true" xsi:type="string">Label Options</item>
      <item name="config" xsi:type="array">
      <item name="dataScope" xsi:type="string">data</item>
      <item name="namespace" xsi:type="string">managelabels_productlabel_form</item>
      </item>
      <item name="reverseMetadataMerge" xsi:type="boolean">true</item>
      </argument>
      <settings>
      <buttons>
      <button class="NamespaceModulenameBlockAdminhtmlProductlabelEditBackButton" name="back"/>
      <button class="NamespaceModulenameBlockAdminhtmlProductlabelEditDeleteButton" name="delete"/>
      <button class="NamespaceModulenameBlockAdminhtmlProductlabelEditSaveButton" name="save"/>
      <button class="NamespaceModulenameBlockAdminhtmlProductlabelEditSaveAndContinueButton" name="save_and_continue"/>
      </buttons>
      <layout>
      <navContainerName>left</navContainerName>
      <type>tabs</type>
      </layout>
      <deps>
      <dep>managelabels_productlabel_form.managelabels_productlabel_form_data_source</dep>
      </deps>
      </settings>
      <dataSource name="managelabels_productlabel_form_data_source">
      <argument name="dataProvider" xsi:type="configurableObject">
      <argument name="class" xsi:type="string">NamespaceModulenameModelProductlabelDataProvider</argument>
      <argument name="name" xsi:type="string">managelabels_productlabel_form_data_source</argument>
      <argument name="primaryFieldName" xsi:type="string">productlabel_id</argument>
      <argument name="requestFieldName" xsi:type="string">id</argument>
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="submit_url" xsi:type="url" path="managelabels/productlabel/save"/>
      </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/form/provider</item>
      </item>
      </argument>
      </dataSource>
      <fieldset name="general">
      <settings>
      <label translate="true">General Info</label>
      </settings>
      <field name="productlabel_id">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="visible" xsi:type="boolean">false</item>
      <item name="dataType" xsi:type="string">text</item>
      <item name="label" xsi:type="string" translate="true">Productlabel ID</item>
      <item name="formElement" xsi:type="string">input</item>
      <item name="source" xsi:type="string">data</item>
      <item name="dataScope" xsi:type="string">productlabel_id</item>
      </item>
      </argument>
      </field>
      <field name="labelname" formElement="input">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="source" xsi:type="string">labelname</item>
      </item>
      </argument>
      <settings>
      <validation>
      <rule name="required-entry" xsi:type="boolean">true</rule>
      </validation>
      <dataType>text</dataType>
      <label translate="true">Label Name</label>
      </settings>
      </field>
      <field name="is_active" sortOrder="10" formElement="checkbox">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="source" xsi:type="string">status</item>
      <item name="default" xsi:type="number">1</item>
      </item>
      </argument>
      <settings>
      <dataType>boolean</dataType>
      <label translate="true">Status</label>
      <dataScope>status</dataScope>
      </settings>
      <formElements>
      <checkbox>
      <settings>
      <valueMap>
      <map name="false" xsi:type="number">0</map>
      <map name="true" xsi:type="number">1</map>
      </valueMap>
      <prefer>toggle</prefer>
      </settings>
      </checkbox>
      </formElements>
      </field>
      <field name="priority" formElement="input">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="source" xsi:type="string">priority</item>
      <item name="notice" xsi:type="string" translate="true">Use 0 to show label first, and 99 to show it last</item>
      </item>
      </argument>
      <settings>
      <validation>
      <rule name="required-entry" xsi:type="boolean">true</rule>
      </validation>
      <dataType>text</dataType>
      <label translate="true">Priority</label>
      </settings>
      </field>
      <field name="start_date">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="dataType" xsi:type="string">string</item>
      <item name="label" xsi:type="string" translate="true">Start Date</item>
      <item name="formElement" xsi:type="string">date</item>
      <item name="source" xsi:type="string">page</item>
      <item name="sortOrder" xsi:type="number">21</item>
      <item name="dataScope" xsi:type="string">start_date</item>
      <item name="validation" xsi:type="array">
      <item name="required-entry" xsi:type="boolean">true</item>
      </item>
      <item name="options" xsi:type="array">
      <item name="dateFormat" xsi:type="string">yyyy-MM-dd</item>
      <item name="timeFormat" xsi:type="string">HH:mm:ss</item>
      <item name="showsTime" xsi:type="boolean">true</item>
      </item>
      </item>
      </argument>
      </field>
      <field name="end_date">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="dataType" xsi:type="string">string</item>
      <item name="label" xsi:type="string" translate="true">Start Date</item>
      <item name="formElement" xsi:type="string">date</item>
      <item name="source" xsi:type="string">page</item>
      <item name="sortOrder" xsi:type="number">21</item>
      <item name="dataScope" xsi:type="string">end_date</item>
      <item name="validation" xsi:type="array">
      <item name="required-entry" xsi:type="boolean">true</item>
      </item>
      <item name="options" xsi:type="array">
      <item name="dateFormat" xsi:type="string">yyyy-MM-dd</item>
      <item name="timeFormat" xsi:type="string">HH:mm:ss</item>
      <item name="showsTime" xsi:type="boolean">true</item>
      </item>
      </item>
      </argument>
      </field>
      </fieldset>
      <fieldset name="labelconfig">
      <settings>
      <label translate="true">Label Configuration</label>
      </settings>
      <field name="image">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="dataType" xsi:type="string">string</item>
      <item name="source" xsi:type="string">image</item>
      <item name="label" xsi:type="string" translate="true">Image</item>
      <item name="visible" xsi:type="boolean">true</item>
      <item name="formElement" xsi:type="string">fileUploader</item>
      <item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
      <item name="previewTmpl" xsi:type="string">Namespace_Modulename/image-preview</item>
      <item name="validation" xsi:type="array">
      <item name="required-entry" xsi:type="boolean">true</item>
      </item>
      <item name="uploaderConfig" xsi:type="array">
      <item name="url" xsi:type="url" path="managelabels/productlabel/upload"/>
      </item>
      </item>
      </argument>
      </field>
      <field name="image_data" sortOrder="20" formElement="hidden">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="source" xsi:type="string">image</item>
      </item>
      </argument>
      <settings>
      <dataType>text</dataType>
      <label translate="true">Image Data</label>
      <dataScope>image_data</dataScope>
      </settings>
      </field>
      <field name="label_text" formElement="input">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="source" xsi:type="string">label_text</item>
      </item>
      </argument>
      <settings>
      <dataType>text</dataType>
      <label translate="true">Label Text</label>
      </settings>
      </field>
      <field name="label_text_data" sortOrder="20" formElement="hidden">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="source" xsi:type="string">image</item>
      </item>
      </argument>
      <settings>
      <dataType>text</dataType>
      <label translate="true">Label Text Data</label>
      <dataScope>label_text_data</dataScope>
      </settings>
      </field>
      </fieldset>
      <fieldset name="condition">
      <settings>
      <label translate="true">Condition</label>
      </settings>
      <field name="store_ids">
      <argument name="data" xsi:type="array">
      <item name="options" xsi:type="object">MagentoCmsUiComponentListingColumnCmsOptions</item>
      <item name="config" xsi:type="array">
      <item name="dataType" xsi:type="string">int</item>
      <item name="label" xsi:type="string" translate="true">Store View</item>
      <item name="formElement" xsi:type="string">multiselect</item>
      <item name="source" xsi:type="string">page</item>
      <item name="dataScope" xsi:type="string">store_ids</item>
      <item name="default" xsi:type="string">0</item>
      <item name="validation" xsi:type="array">
      <item name="required-entry" xsi:type="boolean">true</item>
      </item>
      </item>
      </argument>
      </field>
      <field name="customers_group_ids">
      <argument name="data" xsi:type="array">
      <item name="options" xsi:type="object">MagentoCmsUiComponentListingColumnCmsOptions</item>
      <item name="config" xsi:type="array">
      <item name="label" xsi:type="string" translate="true">Customer Groups</item>
      <item name="dataType" xsi:type="string">number</item>
      <item name="formElement" xsi:type="string">multiselect</item>
      <item name="validation" xsi:type="array">
      <item name="required-entry" xsi:type="boolean">true</item>
      </item>
      <item name="source" xsi:type="string">Namespace_Modulename</item>
      <item name="dataScope" xsi:type="string">customers_group_ids</item>
      </item>
      </argument>
      </field>
      <container name="conditions_apply_to" sortOrder="10">
      <htmlContent name="html_content">
      <block name="conditions_apply_to" class="NamespaceModulenameBlockAdminhtmlProductlabelEditTabConditions" />
      </htmlContent>
      </container>
      </fieldset>
      </form>


      Below is UI dataprovider with given path.




      /app/code/Namespace/Modulename/Model/Productlabel/DataProvider.php




      <?php

      namespace NamespaceModulenameModelProductlabel;

      use MagentoFrameworkAppRequestDataPersistorInterface;
      use MagentoUiDataProviderAbstractDataProvider;
      use NamespaceModulenameModelResourceModelProductlabelCollectionFactory;

      class DataProvider extends AbstractDataProvider
      {
      /**
      * @var ResourceModelDataCollection
      */
      protected $collection;

      /**
      * @var DataPersistorInterface
      */
      protected $dataPersistor;

      /**
      * @var array
      */
      protected $loadedData;

      /**
      * @param string $name
      * @param string $primaryFieldName
      * @param string $requestFieldName
      * @param CollectionFactory $pageCollectionFactory
      * @param DataPersistorInterface $dataPersistor
      * @param array $meta
      * @param array $data
      */
      public function __construct(
      $name,
      $primaryFieldName,
      $requestFieldName,
      CollectionFactory $pageCollectionFactory,
      DataPersistorInterface $dataPersistor,
      array $meta = ,
      array $data =
      ) {
      $this->collection = $pageCollectionFactory->create();
      $this->dataPersistor = $dataPersistor;
      $this->meta = $this->prepareMeta($this->meta);
      parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
      }

      /**
      * Prepares Meta
      *
      * @param array $meta
      * @return array
      */
      public function prepareMeta(array $meta)
      {
      return $meta;
      }

      /**
      * Get data
      *
      * @return array
      */
      public function getData()
      {
      if (isset($this->loadedData)) {
      return $this->loadedData;
      }
      $items = $this->collection->getItems();
      $ruleId = '';
      foreach ($items as $page) {
      $this->loadedData[$page->getId()] = $page->getData();
      $ruleId = $page->getId();
      }
      $data = $this->dataPersistor->get('module_messages');
      if (!empty($data)) {
      $page = $this->collection->getNewEmptyItem();
      $page->setData($data);
      $this->loadedData[$page->getId()] = $page->getData();
      $this->dataPersistor->clear('module_messages');
      }

      return $this->loadedData;
      }
      }


      There is something is missing or wrong in above code but i can't find out what is it.



      I try a lots but no luck to solved out problem. can anyone help me?



      Any help would be appreciated! Thanks.







      uicomponent adminform ui-form magento2.3.0 data-provider






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited yesterday







      Chirag Patel

















      asked yesterday









      Chirag PatelChirag Patel

      1,978220




      1,978220






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "479"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f257071%2fmagento-2-3-0-while-edit-ui-component-form-data-not-filled-up-in-custom-module%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f257071%2fmagento-2-3-0-while-edit-ui-component-form-data-not-filled-up-in-custom-module%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          1300-talet

          1300-talet

          Display a custom attribute below product name in the front-end Magento 1.9.3.8