Magento 2 - Dynamic rows based on related products modal grid on custom form with tabs Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?How can i rewrite TierPrice Block in Magento2Magento 2:Custom Field Value in Edit Products SectionMagento 2 - insertListing ui componentAdd custom dynamic column in sales order grid Magento 2Magento 2.2.0 : TypeError: element.getRecordCount is not a function in dynamic rows in admin formAn Error while add a complex component modal as insertlisting for add dynamic row in my ui-component admin formMagento 2 declaring modifier PHP Fatal Error: null given in $modifiersMissing required argument $modifiers of MagentoUiDataProviderModifierPoolError is showing saved data from database and display in dynamic row grid Magento 2How To Add Custom Data Into Product Edit Form DynamicRows Ui Component
Is the time—manner—place ordering of adverbials an oversimplification?
Statistical analysis applied to methods coming out of Machine Learning
What is "Lambda" in Heston's original paper on stochastic volatility models?
Is it OK to use the testing sample to compare algorithms?
Centre cell vertically in tabularx
How do you write "wild blueberries flavored"?
Sally's older brother
Determine whether an integer is a palindrome
Does the main washing effect of soap come from foam?
Did John Wesley plagiarize Matthew Henry...?
One-one communication
New Order #6: Easter Egg
Baking rewards as operations
Keep at all times, the minus sign above aligned with minus sign below
malloc in main() or malloc in another function: allocating memory for a struct and its members
Flight departed from the gate 5 min before scheduled departure time. Refund options
3D Masyu - A Die
How do I find my Spellcasting Ability for my D&D character?
What is a more techy Technical Writer job title that isn't cutesy or confusing?
Plotting a Maclaurin series
Does the universe have a fixed centre of mass?
How to name indistinguishable henchmen in a screenplay?
Short story about astronauts fertilizing soil with their own bodies
Twin's vs. Twins'
Magento 2 - Dynamic rows based on related products modal grid on custom form with tabs
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?How can i rewrite TierPrice Block in Magento2Magento 2:Custom Field Value in Edit Products SectionMagento 2 - insertListing ui componentAdd custom dynamic column in sales order grid Magento 2Magento 2.2.0 : TypeError: element.getRecordCount is not a function in dynamic rows in admin formAn Error while add a complex component modal as insertlisting for add dynamic row in my ui-component admin formMagento 2 declaring modifier PHP Fatal Error: null given in $modifiersMissing required argument $modifiers of MagentoUiDataProviderModifierPoolError is showing saved data from database and display in dynamic row grid Magento 2How To Add Custom Data Into Product Edit Form DynamicRows Ui Component
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am working on magento 2.1 backend module. Basically backend part is a form that contain tabs. I ahve here some standard inputs but also some dynamic rows etc. Everything is working fine except the last tab. Last tab is a MODAL that allow us to choose products that will not be available for the entity that we are editing/creating.
Basically 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 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 custom form:
- custom tab with button "Add unavailable products"
- after click modal render
- inside modal I have a product list
- when selecting product and clicking "Add selected products" modal disappear
- when opening modal again the list is filtered (does not contain previously selected elements)
- DYNAMIC GRID is not populated :(
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 a idea what to do to make it works?
I saw some referrences into this doc:
http://devdocs.magento.com/guides/v2.1/ui-components/ui_dynamic_rows.html
but it is not working :/
This is how the tab looks like:
Some implementation details:
Main form is declared on adminhtml/ui_component/my_component_form.xml and looks like this:
<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">my_component_form.my_component_form_data_source</item>
<item name="deps" xsi:type="string">my_component_form.my_component_form_data_source</item>
<item name="namespace" xsi:type="string">my_component_form</item>
</item>
<item name="label" xsi:type="string" translate="true">Agency Information</item>
<item name="layout" xsi:type="array">
<item name="type" xsi:type="string">tabs</item>
<item name="navContainerName" xsi:type="string">left</item>
</item>
<item name="buttons" xsi:type="array">
<item name="back" xsi:type="string">MyModuleAgencyBlockAdminhtmlAgencyEditBackButton</item>
<item name="delete" xsi:type="string">MyModuleAgencyBlockAdminhtmlAgencyEditDeleteButton</item>
<item name="reset" xsi:type="string">MyModuleAgencyBlockAdminhtmlAgencyEditResetButton</item>
<item name="save" xsi:type="string">MyModuleAgencyBlockAdminhtmlAgencyEditSaveButton</item>
<item name="save_and_continue" xsi:type="string">MyModuleAgencyBlockAdminhtmlAgencyEditSaveAndContinueButton</item>
</item>
<item name="reverseMetadataMerge" xsi:type="boolean">true</item>
</argument>
<dataSource name="my_component_form_data_source">
<argument name="dataProvider" xsi:type="configurableObject">
<argument name="class" xsi:type="string">MyModuleAgencyUiComponentEditForm</argument>
<argument name="name" xsi:type="string">my_component_form_data_source</argument>
<argument name="primaryFieldName" xsi:type="string">agency_id</argument>
<argument name="requestFieldName" xsi:type="string">agency_id</argument>
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="submit_url" xsi:type="url" path="my_component/agency/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>
Last tab is added with Modifier class (like Related product), and my adminhtml/di.xml file looks like:
<virtualType name="MyModuleAgencyUiComponentEditModifierPool" type="MagentoUiDataProviderModifierPool">
<arguments>
<argument name="modifiers" xsi:type="array">
<item name="availability" xsi:type="array">
<item name="class" xsi:type="string">MyModuleAgencyUiComponentEditModifierUnavailableProducts</item>
<item name="sortOrder" xsi:type="number">200</item>
</item>
</argument>
</arguments>
</virtualType>
<type name="MyModuleAgencyUiComponentEditForm">
<arguments>
<argument name="pool" xsi:type="object">MyModuleAgencyUiComponentEditModifierPool</argument>
</arguments>
</type>
<type name="MyModuleAgencyUiComponentEditModifierUnavailableProducts">
<arguments>
<argument name="scopeName" xsi:type="string">my_component_form.areas</argument>
</arguments>
</type>
My getMeta method on DataProvider class (Form) is:
public function getMeta()
$meta = parent::getMeta();
/** @var ModifierInterface $modifier */
foreach ($this->pool->getModifiersInstances() as $modifier)
$meta = $modifier->modifyMeta($meta);
return $meta;
And last part -> my modifier class extends Related products class, and field construction looks like:
class UnavailableProducts extends Related
{
...
...
...
/**
* @inheritdoc
*/
protected function getButtonSet(Phrase $content, Phrase $buttonTitle, $scope)
$config = parent::getButtonSet($content, $buttonTitle, $scope);
$modalTarget = $this->scopeName . '.' . 'unavailable' . '.' . $scope . '.modal';
// We need to update some button config in order to make sure that the modal box is linked to the proper button
$config['children']['button_' . $scope]['arguments']['data']['config']['actions'][0]['targetName'] = $modalTarget;
$config['children']['button_' . $scope]['arguments']['data']['config']['actions'][1]['targetName'] = $modalTarget . '.' . $scope . '_product_listing';
return $config;
public function modifyMeta(array $meta)
$meta = array_replace_recursive(
$meta,
[
// Let's add a new fieldset group
static::EASYCORE_AGENCY => [
'children' => [
'button_set' => $this->getButtonSet(
__('Products that are present here are not available for this agency'),
__('Add Unavailable Products'),
$this->scopePrefix . 'unavailable'
),
'modal' => $this->getGenericModal(
__('Add Unavailable Products'),
$this->scopePrefix . 'unavailable'
),
'unavailable' => $this->getGrid('unavailable')
],
'arguments' => [
'data' => [
'config' => [
'label' => __('Unavailable products'),
'collapsible' => false,
'componentType' => Fieldset::NAME,
'dataScope' => static::DATA_SCOPE,
'sortOrder' => 200
],
],
],
],
]
);
return $meta;
If we take a look inside Related class we will see that on grid config there is value like:
'links' => [
'insertData' => '$ $.provider :$ $.dataProvider '
],
I suspect that the problem is somewhere on grid or dynamic row configuration... But I am unable to find it on my own :/ Any help would be great.
magento2 grid modal dynamic-rows
add a comment |
I am working on magento 2.1 backend module. Basically backend part is a form that contain tabs. I ahve here some standard inputs but also some dynamic rows etc. Everything is working fine except the last tab. Last tab is a MODAL that allow us to choose products that will not be available for the entity that we are editing/creating.
Basically 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 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 custom form:
- custom tab with button "Add unavailable products"
- after click modal render
- inside modal I have a product list
- when selecting product and clicking "Add selected products" modal disappear
- when opening modal again the list is filtered (does not contain previously selected elements)
- DYNAMIC GRID is not populated :(
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 a idea what to do to make it works?
I saw some referrences into this doc:
http://devdocs.magento.com/guides/v2.1/ui-components/ui_dynamic_rows.html
but it is not working :/
This is how the tab looks like:
Some implementation details:
Main form is declared on adminhtml/ui_component/my_component_form.xml and looks like this:
<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">my_component_form.my_component_form_data_source</item>
<item name="deps" xsi:type="string">my_component_form.my_component_form_data_source</item>
<item name="namespace" xsi:type="string">my_component_form</item>
</item>
<item name="label" xsi:type="string" translate="true">Agency Information</item>
<item name="layout" xsi:type="array">
<item name="type" xsi:type="string">tabs</item>
<item name="navContainerName" xsi:type="string">left</item>
</item>
<item name="buttons" xsi:type="array">
<item name="back" xsi:type="string">MyModuleAgencyBlockAdminhtmlAgencyEditBackButton</item>
<item name="delete" xsi:type="string">MyModuleAgencyBlockAdminhtmlAgencyEditDeleteButton</item>
<item name="reset" xsi:type="string">MyModuleAgencyBlockAdminhtmlAgencyEditResetButton</item>
<item name="save" xsi:type="string">MyModuleAgencyBlockAdminhtmlAgencyEditSaveButton</item>
<item name="save_and_continue" xsi:type="string">MyModuleAgencyBlockAdminhtmlAgencyEditSaveAndContinueButton</item>
</item>
<item name="reverseMetadataMerge" xsi:type="boolean">true</item>
</argument>
<dataSource name="my_component_form_data_source">
<argument name="dataProvider" xsi:type="configurableObject">
<argument name="class" xsi:type="string">MyModuleAgencyUiComponentEditForm</argument>
<argument name="name" xsi:type="string">my_component_form_data_source</argument>
<argument name="primaryFieldName" xsi:type="string">agency_id</argument>
<argument name="requestFieldName" xsi:type="string">agency_id</argument>
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="submit_url" xsi:type="url" path="my_component/agency/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>
Last tab is added with Modifier class (like Related product), and my adminhtml/di.xml file looks like:
<virtualType name="MyModuleAgencyUiComponentEditModifierPool" type="MagentoUiDataProviderModifierPool">
<arguments>
<argument name="modifiers" xsi:type="array">
<item name="availability" xsi:type="array">
<item name="class" xsi:type="string">MyModuleAgencyUiComponentEditModifierUnavailableProducts</item>
<item name="sortOrder" xsi:type="number">200</item>
</item>
</argument>
</arguments>
</virtualType>
<type name="MyModuleAgencyUiComponentEditForm">
<arguments>
<argument name="pool" xsi:type="object">MyModuleAgencyUiComponentEditModifierPool</argument>
</arguments>
</type>
<type name="MyModuleAgencyUiComponentEditModifierUnavailableProducts">
<arguments>
<argument name="scopeName" xsi:type="string">my_component_form.areas</argument>
</arguments>
</type>
My getMeta method on DataProvider class (Form) is:
public function getMeta()
$meta = parent::getMeta();
/** @var ModifierInterface $modifier */
foreach ($this->pool->getModifiersInstances() as $modifier)
$meta = $modifier->modifyMeta($meta);
return $meta;
And last part -> my modifier class extends Related products class, and field construction looks like:
class UnavailableProducts extends Related
{
...
...
...
/**
* @inheritdoc
*/
protected function getButtonSet(Phrase $content, Phrase $buttonTitle, $scope)
$config = parent::getButtonSet($content, $buttonTitle, $scope);
$modalTarget = $this->scopeName . '.' . 'unavailable' . '.' . $scope . '.modal';
// We need to update some button config in order to make sure that the modal box is linked to the proper button
$config['children']['button_' . $scope]['arguments']['data']['config']['actions'][0]['targetName'] = $modalTarget;
$config['children']['button_' . $scope]['arguments']['data']['config']['actions'][1]['targetName'] = $modalTarget . '.' . $scope . '_product_listing';
return $config;
public function modifyMeta(array $meta)
$meta = array_replace_recursive(
$meta,
[
// Let's add a new fieldset group
static::EASYCORE_AGENCY => [
'children' => [
'button_set' => $this->getButtonSet(
__('Products that are present here are not available for this agency'),
__('Add Unavailable Products'),
$this->scopePrefix . 'unavailable'
),
'modal' => $this->getGenericModal(
__('Add Unavailable Products'),
$this->scopePrefix . 'unavailable'
),
'unavailable' => $this->getGrid('unavailable')
],
'arguments' => [
'data' => [
'config' => [
'label' => __('Unavailable products'),
'collapsible' => false,
'componentType' => Fieldset::NAME,
'dataScope' => static::DATA_SCOPE,
'sortOrder' => 200
],
],
],
],
]
);
return $meta;
If we take a look inside Related class we will see that on grid config there is value like:
'links' => [
'insertData' => '$ $.provider :$ $.dataProvider '
],
I suspect that the problem is somewhere on grid or dynamic row configuration... But I am unable to find it on my own :/ Any help would be great.
magento2 grid modal dynamic-rows
add a comment |
I am working on magento 2.1 backend module. Basically backend part is a form that contain tabs. I ahve here some standard inputs but also some dynamic rows etc. Everything is working fine except the last tab. Last tab is a MODAL that allow us to choose products that will not be available for the entity that we are editing/creating.
Basically 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 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 custom form:
- custom tab with button "Add unavailable products"
- after click modal render
- inside modal I have a product list
- when selecting product and clicking "Add selected products" modal disappear
- when opening modal again the list is filtered (does not contain previously selected elements)
- DYNAMIC GRID is not populated :(
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 a idea what to do to make it works?
I saw some referrences into this doc:
http://devdocs.magento.com/guides/v2.1/ui-components/ui_dynamic_rows.html
but it is not working :/
This is how the tab looks like:
Some implementation details:
Main form is declared on adminhtml/ui_component/my_component_form.xml and looks like this:
<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">my_component_form.my_component_form_data_source</item>
<item name="deps" xsi:type="string">my_component_form.my_component_form_data_source</item>
<item name="namespace" xsi:type="string">my_component_form</item>
</item>
<item name="label" xsi:type="string" translate="true">Agency Information</item>
<item name="layout" xsi:type="array">
<item name="type" xsi:type="string">tabs</item>
<item name="navContainerName" xsi:type="string">left</item>
</item>
<item name="buttons" xsi:type="array">
<item name="back" xsi:type="string">MyModuleAgencyBlockAdminhtmlAgencyEditBackButton</item>
<item name="delete" xsi:type="string">MyModuleAgencyBlockAdminhtmlAgencyEditDeleteButton</item>
<item name="reset" xsi:type="string">MyModuleAgencyBlockAdminhtmlAgencyEditResetButton</item>
<item name="save" xsi:type="string">MyModuleAgencyBlockAdminhtmlAgencyEditSaveButton</item>
<item name="save_and_continue" xsi:type="string">MyModuleAgencyBlockAdminhtmlAgencyEditSaveAndContinueButton</item>
</item>
<item name="reverseMetadataMerge" xsi:type="boolean">true</item>
</argument>
<dataSource name="my_component_form_data_source">
<argument name="dataProvider" xsi:type="configurableObject">
<argument name="class" xsi:type="string">MyModuleAgencyUiComponentEditForm</argument>
<argument name="name" xsi:type="string">my_component_form_data_source</argument>
<argument name="primaryFieldName" xsi:type="string">agency_id</argument>
<argument name="requestFieldName" xsi:type="string">agency_id</argument>
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="submit_url" xsi:type="url" path="my_component/agency/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>
Last tab is added with Modifier class (like Related product), and my adminhtml/di.xml file looks like:
<virtualType name="MyModuleAgencyUiComponentEditModifierPool" type="MagentoUiDataProviderModifierPool">
<arguments>
<argument name="modifiers" xsi:type="array">
<item name="availability" xsi:type="array">
<item name="class" xsi:type="string">MyModuleAgencyUiComponentEditModifierUnavailableProducts</item>
<item name="sortOrder" xsi:type="number">200</item>
</item>
</argument>
</arguments>
</virtualType>
<type name="MyModuleAgencyUiComponentEditForm">
<arguments>
<argument name="pool" xsi:type="object">MyModuleAgencyUiComponentEditModifierPool</argument>
</arguments>
</type>
<type name="MyModuleAgencyUiComponentEditModifierUnavailableProducts">
<arguments>
<argument name="scopeName" xsi:type="string">my_component_form.areas</argument>
</arguments>
</type>
My getMeta method on DataProvider class (Form) is:
public function getMeta()
$meta = parent::getMeta();
/** @var ModifierInterface $modifier */
foreach ($this->pool->getModifiersInstances() as $modifier)
$meta = $modifier->modifyMeta($meta);
return $meta;
And last part -> my modifier class extends Related products class, and field construction looks like:
class UnavailableProducts extends Related
{
...
...
...
/**
* @inheritdoc
*/
protected function getButtonSet(Phrase $content, Phrase $buttonTitle, $scope)
$config = parent::getButtonSet($content, $buttonTitle, $scope);
$modalTarget = $this->scopeName . '.' . 'unavailable' . '.' . $scope . '.modal';
// We need to update some button config in order to make sure that the modal box is linked to the proper button
$config['children']['button_' . $scope]['arguments']['data']['config']['actions'][0]['targetName'] = $modalTarget;
$config['children']['button_' . $scope]['arguments']['data']['config']['actions'][1]['targetName'] = $modalTarget . '.' . $scope . '_product_listing';
return $config;
public function modifyMeta(array $meta)
$meta = array_replace_recursive(
$meta,
[
// Let's add a new fieldset group
static::EASYCORE_AGENCY => [
'children' => [
'button_set' => $this->getButtonSet(
__('Products that are present here are not available for this agency'),
__('Add Unavailable Products'),
$this->scopePrefix . 'unavailable'
),
'modal' => $this->getGenericModal(
__('Add Unavailable Products'),
$this->scopePrefix . 'unavailable'
),
'unavailable' => $this->getGrid('unavailable')
],
'arguments' => [
'data' => [
'config' => [
'label' => __('Unavailable products'),
'collapsible' => false,
'componentType' => Fieldset::NAME,
'dataScope' => static::DATA_SCOPE,
'sortOrder' => 200
],
],
],
],
]
);
return $meta;
If we take a look inside Related class we will see that on grid config there is value like:
'links' => [
'insertData' => '$ $.provider :$ $.dataProvider '
],
I suspect that the problem is somewhere on grid or dynamic row configuration... But I am unable to find it on my own :/ Any help would be great.
magento2 grid modal dynamic-rows
I am working on magento 2.1 backend module. Basically backend part is a form that contain tabs. I ahve here some standard inputs but also some dynamic rows etc. Everything is working fine except the last tab. Last tab is a MODAL that allow us to choose products that will not be available for the entity that we are editing/creating.
Basically 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 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 custom form:
- custom tab with button "Add unavailable products"
- after click modal render
- inside modal I have a product list
- when selecting product and clicking "Add selected products" modal disappear
- when opening modal again the list is filtered (does not contain previously selected elements)
- DYNAMIC GRID is not populated :(
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 a idea what to do to make it works?
I saw some referrences into this doc:
http://devdocs.magento.com/guides/v2.1/ui-components/ui_dynamic_rows.html
but it is not working :/
This is how the tab looks like:
Some implementation details:
Main form is declared on adminhtml/ui_component/my_component_form.xml and looks like this:
<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">my_component_form.my_component_form_data_source</item>
<item name="deps" xsi:type="string">my_component_form.my_component_form_data_source</item>
<item name="namespace" xsi:type="string">my_component_form</item>
</item>
<item name="label" xsi:type="string" translate="true">Agency Information</item>
<item name="layout" xsi:type="array">
<item name="type" xsi:type="string">tabs</item>
<item name="navContainerName" xsi:type="string">left</item>
</item>
<item name="buttons" xsi:type="array">
<item name="back" xsi:type="string">MyModuleAgencyBlockAdminhtmlAgencyEditBackButton</item>
<item name="delete" xsi:type="string">MyModuleAgencyBlockAdminhtmlAgencyEditDeleteButton</item>
<item name="reset" xsi:type="string">MyModuleAgencyBlockAdminhtmlAgencyEditResetButton</item>
<item name="save" xsi:type="string">MyModuleAgencyBlockAdminhtmlAgencyEditSaveButton</item>
<item name="save_and_continue" xsi:type="string">MyModuleAgencyBlockAdminhtmlAgencyEditSaveAndContinueButton</item>
</item>
<item name="reverseMetadataMerge" xsi:type="boolean">true</item>
</argument>
<dataSource name="my_component_form_data_source">
<argument name="dataProvider" xsi:type="configurableObject">
<argument name="class" xsi:type="string">MyModuleAgencyUiComponentEditForm</argument>
<argument name="name" xsi:type="string">my_component_form_data_source</argument>
<argument name="primaryFieldName" xsi:type="string">agency_id</argument>
<argument name="requestFieldName" xsi:type="string">agency_id</argument>
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="submit_url" xsi:type="url" path="my_component/agency/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>
Last tab is added with Modifier class (like Related product), and my adminhtml/di.xml file looks like:
<virtualType name="MyModuleAgencyUiComponentEditModifierPool" type="MagentoUiDataProviderModifierPool">
<arguments>
<argument name="modifiers" xsi:type="array">
<item name="availability" xsi:type="array">
<item name="class" xsi:type="string">MyModuleAgencyUiComponentEditModifierUnavailableProducts</item>
<item name="sortOrder" xsi:type="number">200</item>
</item>
</argument>
</arguments>
</virtualType>
<type name="MyModuleAgencyUiComponentEditForm">
<arguments>
<argument name="pool" xsi:type="object">MyModuleAgencyUiComponentEditModifierPool</argument>
</arguments>
</type>
<type name="MyModuleAgencyUiComponentEditModifierUnavailableProducts">
<arguments>
<argument name="scopeName" xsi:type="string">my_component_form.areas</argument>
</arguments>
</type>
My getMeta method on DataProvider class (Form) is:
public function getMeta()
$meta = parent::getMeta();
/** @var ModifierInterface $modifier */
foreach ($this->pool->getModifiersInstances() as $modifier)
$meta = $modifier->modifyMeta($meta);
return $meta;
And last part -> my modifier class extends Related products class, and field construction looks like:
class UnavailableProducts extends Related
{
...
...
...
/**
* @inheritdoc
*/
protected function getButtonSet(Phrase $content, Phrase $buttonTitle, $scope)
$config = parent::getButtonSet($content, $buttonTitle, $scope);
$modalTarget = $this->scopeName . '.' . 'unavailable' . '.' . $scope . '.modal';
// We need to update some button config in order to make sure that the modal box is linked to the proper button
$config['children']['button_' . $scope]['arguments']['data']['config']['actions'][0]['targetName'] = $modalTarget;
$config['children']['button_' . $scope]['arguments']['data']['config']['actions'][1]['targetName'] = $modalTarget . '.' . $scope . '_product_listing';
return $config;
public function modifyMeta(array $meta)
$meta = array_replace_recursive(
$meta,
[
// Let's add a new fieldset group
static::EASYCORE_AGENCY => [
'children' => [
'button_set' => $this->getButtonSet(
__('Products that are present here are not available for this agency'),
__('Add Unavailable Products'),
$this->scopePrefix . 'unavailable'
),
'modal' => $this->getGenericModal(
__('Add Unavailable Products'),
$this->scopePrefix . 'unavailable'
),
'unavailable' => $this->getGrid('unavailable')
],
'arguments' => [
'data' => [
'config' => [
'label' => __('Unavailable products'),
'collapsible' => false,
'componentType' => Fieldset::NAME,
'dataScope' => static::DATA_SCOPE,
'sortOrder' => 200
],
],
],
],
]
);
return $meta;
If we take a look inside Related class we will see that on grid config there is value like:
'links' => [
'insertData' => '$ $.provider :$ $.dataProvider '
],
I suspect that the problem is somewhere on grid or dynamic row configuration... But I am unable to find it on my own :/ Any help would be great.
magento2 grid modal dynamic-rows
magento2 grid modal dynamic-rows
edited Nov 23 '16 at 13:52
Marius♦
168k28324692
168k28324692
asked Nov 23 '16 at 13:28
Arek T.Arek T.
9617
9617
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Looks like dynamicRows dataScope & dataProvider is wrong. I faced same problem. After changing dataScope & dataProvider grid is populated.
<dynamicRows name="orders">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataScope" xsi:type="string">data.orders_tab.links</item>
<item name="dataProvider" xsi:type="string">data.orders_tab.my_module_sales_order_listing</item>
</item>
</argument>
<container name="record"/>
Before:
<item name="dataScope" xsi:type="string">data.links</item>
After:
<item name="dataScope" xsi:type="string">data.orders_tab.links</item>
orders_tab is name of tab where are dynamicRows & insertListing placed.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f147180%2fmagento-2-dynamic-rows-based-on-related-products-modal-grid-on-custom-form-wit%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Looks like dynamicRows dataScope & dataProvider is wrong. I faced same problem. After changing dataScope & dataProvider grid is populated.
<dynamicRows name="orders">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataScope" xsi:type="string">data.orders_tab.links</item>
<item name="dataProvider" xsi:type="string">data.orders_tab.my_module_sales_order_listing</item>
</item>
</argument>
<container name="record"/>
Before:
<item name="dataScope" xsi:type="string">data.links</item>
After:
<item name="dataScope" xsi:type="string">data.orders_tab.links</item>
orders_tab is name of tab where are dynamicRows & insertListing placed.
add a comment |
Looks like dynamicRows dataScope & dataProvider is wrong. I faced same problem. After changing dataScope & dataProvider grid is populated.
<dynamicRows name="orders">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataScope" xsi:type="string">data.orders_tab.links</item>
<item name="dataProvider" xsi:type="string">data.orders_tab.my_module_sales_order_listing</item>
</item>
</argument>
<container name="record"/>
Before:
<item name="dataScope" xsi:type="string">data.links</item>
After:
<item name="dataScope" xsi:type="string">data.orders_tab.links</item>
orders_tab is name of tab where are dynamicRows & insertListing placed.
add a comment |
Looks like dynamicRows dataScope & dataProvider is wrong. I faced same problem. After changing dataScope & dataProvider grid is populated.
<dynamicRows name="orders">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataScope" xsi:type="string">data.orders_tab.links</item>
<item name="dataProvider" xsi:type="string">data.orders_tab.my_module_sales_order_listing</item>
</item>
</argument>
<container name="record"/>
Before:
<item name="dataScope" xsi:type="string">data.links</item>
After:
<item name="dataScope" xsi:type="string">data.orders_tab.links</item>
orders_tab is name of tab where are dynamicRows & insertListing placed.
Looks like dynamicRows dataScope & dataProvider is wrong. I faced same problem. After changing dataScope & dataProvider grid is populated.
<dynamicRows name="orders">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataScope" xsi:type="string">data.orders_tab.links</item>
<item name="dataProvider" xsi:type="string">data.orders_tab.my_module_sales_order_listing</item>
</item>
</argument>
<container name="record"/>
Before:
<item name="dataScope" xsi:type="string">data.links</item>
After:
<item name="dataScope" xsi:type="string">data.orders_tab.links</item>
orders_tab is name of tab where are dynamicRows & insertListing placed.
answered Dec 26 '18 at 13:19
lateNIGHTlateNIGHT
111
111
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f147180%2fmagento-2-dynamic-rows-based-on-related-products-modal-grid-on-custom-form-wit%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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