jmix-framework / jmix

Jmix framework
https://www.jmix.io
Apache License 2.0
555 stars 118 forks source link

Throw GuiDevelopmentException when using incorrect container type #514

Closed glebfox closed 3 months ago

glebfox commented 3 years ago

See https://github.com/cuba-platform/cuba/issues/3173 as an example

KremnevDmitry commented 3 months ago

Could you provide more information about the issue? Which container type is not considered correct?

glebfox commented 3 months ago

Could you provide more information about the issue? Which container type is not considered correct?

Instance container cannot be used as dataContainer for DataGrid or itemsContainer for ComboBox like components

KremnevDmitry commented 3 months ago

Using CollectionPropertyContainer to display a selection list is valid for Jmix Framework.

    <data>
        <instance id="orderDc"
                  class="com.company.master.entity.Order">
            <fetchPlan extends="_base">
                <property name="customer" fetchPlan="_instance_name"/>
                <property name="orderItems" fetchPlan="_base"/>
            </fetchPlan>
            <collection id="orderItemsDc" property="orderItems"/>
            <loader id="orderDl"/>
        </instance>
    </data>
    <layout>
    <!-- some code -->
       <textField label="Favorite" dataContainer="orderItemsDc" property="name" readOnly="true"/>
   </layout>

Result: image