I'm working on an admin ui form


I've added tabs

In order to get the tabs working I've removed the <item name="template" xsi:type="string">templates/form/collapsible</item> from the XML

My form elements have changed from <input name="name"> to <input name="general[name]">

Which makes sense

However when editing a record the form fields now appear blank. I've forgotten a step.

It's to do with dataScope and chaining

enter image description here

Any suggestion?

1 Answer 1


I overlooked this comment

The source node's value corresponds to a key in the data array returned by the \Magento\Framework\View\Element\UiComponent\DataProvider\DataProviderInterface::getData method of your UI component.

From https://magento.stackexchange.com/a/219692/70343

Sure enough

     * Get data
     * @return array
    public function getData()
        if (isset($this->loadedData)) {
            return $this->loadedData;
        $items = $this->collection->getItems();
        foreach ($items as $model) {
            $this->loadedData[$model->getId()] = $model->getData();
            $this->loadedData[$model->getId()]['general'] = $model->getData();  // key part
        $data = $this->dataPersistor->get('xigen_announce_group');

        if (!empty($data)) {
            $model = $this->collection->getNewEmptyItem();
            $this->loadedData[$model->getId()] = $model->getData();
            $this->loadedData[$model->getId()]['general'] = $model->getData(); // key part

        return $this->loadedData;

Helped to look at this https://github.com/magento/magento2/blob/2.3/app/code/Magento/Customer/Model/Customer/DataProvider.php#L214-L252

I hope this helps someone. Might save them an hour.

  • Thanks a lot !!!! I am looking for a solution of this problem since 8 hours. Jan 16, 2023 at 17:19

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.