3

I am working on Magento 2.2.1 backend module. Basically backend part is a form that contains UI COMPONENT tabs. Everything is working fine except the last dynamic data rendered after saving the dynamic rows data.

I have taken reference from the Magento core related product section. Basically, the idea of working is exactly same as on product edit form for related products, so: we have a button "Add related products", modal render with the grid of products then we can select them and after click "Add selected products" we have them rendered in dynamic grid rows.

I was able to reproduce some part of this logic on my customs form:

custom tab with the button "Add group products" with the help of modifiers. after click modal render inside modal, I have a product list when selecting the product and clicking "Add selected products" modal disappear and selected products are inserting with dynamic data rows into my customs form with the help of insert listing of Magento 2. when opening modal again the list is filtered (does not contain previously selected elements) The DYNAMIC GRID is populating inside my customs form and I am able to save those data into my custom tables. Here, I am unable to display the saved data inside my form in the dynamic grid-like Magento related products. I do not know where is the problem with dynamic grid :/ there are no errors in the console, no error logs, etc. Does anyone worked with those components or maybe have an idea what to do to make it works?

I have added the below code inside getData() in my custom form data provider

/** @var ModifierInterface $modifier */

    foreach ($this->pool->getModifiersInstances() as $modifier) {

        $this->loadedData = $modifier->modifyData($this->loadedData);

    }

and in my form modifier modifyData() function retriving the data and passing the same to the fillData() function to rendered the data in the dynamic grid.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.