Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Entity Relation creates a drop down in both tables edit pages #43

Open
lanrosta opened this issue Nov 3, 2017 · 0 comments
Open

Comments

@lanrosta
Copy link

lanrosta commented Nov 3, 2017

Setup: I created an Entity Relation for two tables (Positions and Applicants). The Positions table will hold job positions and the Applicants edit page will show a dropdown field of the positions. My relationship is setup as 'position' is Entity 1 and Applicants is entity 2 with an 'Entity 1 is Parent' relationship and set to 'required'.

Issue: When I use the 'Add Position' admin feature, the Edit page shows a dropdown field for 'Position' (it also has one in the Edit page for Applicant, which is correct). This should not be showing here on the Position Edit page as this is the page to add records to the same 'Position' table. And, since I set this as a required field (because it needs to be on the Applicant Add/Edit page), I have an empty dropdown that is required and I cannot add any records to the Position table because it is empty. This field should simply not be added to the same tables' Add/Edit pages, instead only to the Child tables Add/Edit pages. It makes no sense being there in the parent table add/edit pages.

EDIT: I fixed this by removing the block of XML in the Positions 'view/adminhtml/ui_component/position_form.xml' page and the ''view/adminhtml/ui_component/position_listing.xml' page. I just removed the block that displayed the dropdown on the position edit page. This works.

This is the block I removed...

    <field name="position_careerapplicant_id">
        <argument name="data" xsi:type="array">
            <item name="options" xsi:type="object">MyCompany\Careers\Source\Careerapplicant</item>
            <item name="config" xsi:type="array">
                <item name="dataType" xsi:type="string">text</item>
                <item name="label" xsi:type="string" translate="true">Position</item>
                <item name="formElement" xsi:type="string">select</item>
                <item name="source" xsi:type="string">careerposition</item>
                <item name="dataScope" xsi:type="string">position_careerapplicant_id</item>
                <item name="validation" xsi:type="array">
                    <item name="required-entry" xsi:type="boolean">true</item>
                </item>
            </item>
        </argument>
    </field>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant