0

Replace this multi-select for this field like magento product configuration

My code to generate the field multi-select

$fieldset->addField('multiselect2', 'multiselect', array(
            'label'     => __('Select Type2'),
            'class'     => 'required-entry',
            'required'  => true,
            'name'      => 'multi',
            'onclick' => "return false;",
            'onchange' => "return false;",
            'elementTmpl' => 'ui/grid/filters/elements/ui-select', // I try this, but not work
            'component' => 'Magento_Ui/js/form/element/ui-select', // I try this, but not work
            'value'  => '4',
            'values' => array(
                '-1'=> array(
                    'label' => 'Please Select..',
                    'value' => '-1'
                ),
                '1' => array(
                    'value'=> Cat::getOptionsToMultiselect(),
                    'label' => __('Category')
                ),
            'after_element_html' => '<small>Comments</small>'
        ));
0

public function toOptionArray()

    $this->attributeOptionsList = [
        [
            'value' => ""Test 1"",
            ""label"" => ""Test 1"",
            ""__disableTmpl"" => 1,
            ""optgroup"" => [
                [
                    'value' => ""Test 1.1"",
                    ""label"" => ""Test 1.1"",
                    ""__disableTmpl"" => 1,
                ],
            ],
        ],
    ];
    return $this->attributeOptionsList;

You can refer to the details here

1
  • I require to use ui-select without any ui-component.xml Add this component to variable $form programmatically \Magento\Framework\Data\Form $form
    – MeChris99
    May 11 at 18:29

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.