I have displayed an admin form using UiComponent form. As one of my admin field I want to display all store views in a multi-select field.

Please help me with a solution.


Add following code into your ui_component form

<field name="storeviews">
    <argument name="data" xsi:type="array">
        <item name="options" xsi:type="object">Magento\Cms\Ui\Component\Listing\Column\Cms\Options</item>
        <item name="config" xsi:type="array">
            <item name="dataType" xsi:type="string">int</item>
            <item name="label" xsi:type="string" translate="true">Store View</item>
            <item name="formElement" xsi:type="string">multiselect</item>
            <item name="source" xsi:type="string">page</item>
            <item name="dataScope" xsi:type="string">store_id</item>
            <item name="default" xsi:type="string">0</item>
            <item name="validation" xsi:type="array">
                <item name="required-entry" xsi:type="boolean">true</item>
  • Thank you. It worked .But just need to end tag item in line 3 – Vindhuja Jan 13 '17 at 7:56
  • I just updated, check now. – Sohel Rana Jan 13 '17 at 8:04

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.