Skip to content

How to add groups fieldset with add row in admin block in magento 2

I need to add groups fieldset or bundle fieldset with “Add Row” section.

like –

enter image description here

    $form = $this->_formFactory->create();
    $form->setHtmlIdPrefix('custom_');
    $customerId = $this->_coreRegistry->registry(
        RegistryConstants::CURRENT_CUSTOMER_ID
    );
    $storeid = $this->_storeManager->getStore()->getId();

    $fieldset = $form->addFieldset(
        'base_fieldset',
        ['legend' => __('Details')]
    );

    $fieldset->addField(
        'percentage',
        'text',
        [
            'name' => 'percentage',
            'data-form-part' => $this->getData('target_form'),
            'label' => __('Percentage'),
            'title' => __('Percentage'),
            'class' => 'validate-number validate-digits-range digits-range-0-100',
            'value' => $rowcom,
        ]
    );