2

I have a category attribute that I have added to the admin view using...

 <fieldset name="general">
        <field name="category_customer_id">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="sortOrder" xsi:type="number">50</item>
                    <item name="dataType" xsi:type="string">string</item>
                    <item name="formElement" xsi:type="string">select</item>
                    <item name="label" xsi:type="string" translate="true">Customer</item>
                    <item name="source" xsi:type="string">companyoptions</item>
                </item>
            </argument>
        </field>
    </fieldset>

This displays the form in the admin but with no options in the dropdown.

I then define the dataSource using

<dataSource name="companyoptions_form_data_source">
        <argument name="dataProvider" xsi:type="configurableObject">
            <!--<argument name="class" xsi:type="string">CompanyGridDataProvider</argument>-->

            <argument name="class" xsi:type="string">Vendor\CustomerProducts\Model\Config\Source\CompanyOptions</argument>
            <argument name="name" xsi:type="string">categry_company_listing_data_source</argument>
            <argument name="primaryFieldName" xsi:type="string">companyId</argument>
            <argument name="requestFieldName" xsi:type="string">id</argument>
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="update_url" xsi:type="url" path="mui/index/render"/>
                </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>

In the Vendor\CustomerProducts\Model\Config\Source\CompanyOptions I have a getData() function which returns the data.... but the category page never loads....

Any help would be great.

Your Answer

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

Browse other questions tagged or ask your own question.