The ui form component works good on "New" action but, if I save this:

New action

Then, the edit action shows this:

Edit action

The data is being saved correctly in my custom table after submitting the "New" action.

Here is the dynamicRows section of my ui form layout:

   <container name="attribute_code_container">
      <dynamicRows name="attribute_code">
            <label translate="true">Attributes / Fields</label>
            <addButtonLabel translate="true">Add attribute</addButtonLabel>
                <param name="enabled" xsi:type="boolean">false</param>
        <container name="record" component="Magento_Ui/js/dynamic-rows/record">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="isTemplate" xsi:type="boolean">true</item>
                    <item name="is_collection" xsi:type="boolean">true</item>
                    <item name="componentType" xsi:type="string">container</item>
            <field name="attribute_code" formElement="select">
                          <options class="Vendor\Module\Model\Source\Attribute"/>
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="componentType" xsi:type="string">actionDelete</item>
                        <item name="dataType" xsi:type="string">text</item>
                        <item name="label" xsi:type="string">Delete</item>
                        <item name="template" xsi:type="string">Magento_Backend/dynamic-rows/cells/action-delete</item>

The Vendor\Module\Model\Source\Attribute class seems to be OK,try with Magento\Config\Model\Config\Source\Yesno (For example) I get the same result.

What is wrong with the dynamicRows component and how can I set an instruction to get the data from my custom table the right way?

  • 1
    Could you add full content of ui form xml, getData method in DataProvider class, and Save controller? That will make us easier to help.
    – Tu Van
    Commented Oct 24, 2022 at 10:33
  • @TuVan the answer is already posted. Commented Nov 2, 2022 at 13:09
  • Glad to hear that. If you posted enough information, I was able to help you earlier.
    – Tu Van
    Commented Nov 2, 2022 at 14:22

1 Answer 1


The layout XML of the dynamicGrid was OK but, because of using a select/option element to show the data, it was expecting an ARRAY and I was providing a string on my dataSource.

Unserializing the data returned by my database made the trick:

public function getData(): array
    if (!isset($this->loadedData)) {
        $this->loadedData = [];

        foreach ($this->collection->getItems() as $item) {
            $this->loadedData[$item->getData('entity_id')] = $item->getData();

            $attributeCodes = $this->serializerJson->unserialize(

            $this->loadedData[$item->getData('entity_id')]['attribute_code'] = $attributeCodes;

    return $this->loadedData;

Where $this->serializerJson is an object of \Magento\Framework\Serialize\Serializer\Json.

If you have similar issues, the thing you have to double-check is the implementation of your dataSource.

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.