2

I developed site in magento 2. i create a custom module. now i want to add Dynamic Rows Component to my module i read document.

http://devdocs.magento.com/guides/v2.1/ui-components/ui_dynamic_rows.html

But i know magento at beginner level. and i can't able to understand after reading document. i can't understand where on which file should i changed.

2

I give you idea how you can do it not whole answer. You create DataProvider in your module this is sample code

protected function getSelectTypeGridConfig($sortOrder) {
    return [
        'arguments' => [
            'data' => [
                'config' => [
                    'addButtonLabel' => __('Add Value'),
                    'componentType' => DynamicRows::NAME,
                    'component' => 'Magento_Ui/js/dynamic-rows/dynamic-rows',
                    'additionalClasses' => 'admin__field-wide',
                    'deleteProperty' => static::FIELD_IS_DELETE,
                    'deleteValue' => '1',
                    'renderDefaultRecord' => false,
                    'sortOrder' => $sortOrder,
                ],
            ],
        ],
        'children' => [
            'record' => [
                'arguments' => [
                    'data' => [
                        'config' => [
                            'componentType' => Container::NAME,
                            'component' => 'Magento_Ui/js/dynamic-rows/record',
                            'positionProvider' => static::FIELD_SORT_ORDER_NAME,
                            'isTemplate' => true,
                            'is_collection' => true,
                        ],
                    ],
                ],
                'children' => [
                    static::FIELD_CUSTOM_NAME => $this->getCustomFieldConfig(10)

                ]
            ]
        ]
    ];
}
protected function getCustomFieldConfig($sortOrder, array $options = []) {
    return array_replace_recursive(
        [
        'arguments' => [
            'data' => [
                'config' => [
                    'label' => __('Test'),
                    'componentType' => Field::NAME,
                    'formElement' => Input::NAME,
                    'dataScope' => static::FIELD_CUSTOM_NAME,
                    'dataType' => Text::NAME,
                    'sortOrder' => $sortOrder,
                ],
            ],
        ],
        ], $options
    );
}

for more detail please check following file Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\CustomOptions.php

0

Alan Storm has an in depth write up regarding UiComponents and how they work. It helped me understand what the configuration settings for the different UiComponents are doing. Referencing it here in hopes it will help you and others:

http://alanstorm.com/magento_2_introducing_ui_components

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.