Change of property is not caught when component is inside <hbox>

Hi all,

I have a problem with editing data when the components for that entity are inside hbox elements.
Take this example below, when writing the dateField I don’t get any suggestions for properties and when I pick a new date in the screen, no dataContext.changeEvent is triggered and the entity does not move into the modified entities in the data context. This can be fixed by adding a “dataContainer” attribute as in the timeField but I would like that all fields use the dataContainer of the form they are in.
Can you please clarify why the hbox has this behavior? I can adapt to that but it is a bit confusing as it is. Thank you! :slight_smile:

<form id="detailsForm" dataContainer="detailsDc" width="100%">
                        <column width="100%">
                            <entityComboBox property="detail1"
                                               optionsContainer="detail1Dc"
                                               width="100%">
                                <actions>
                                    <action id="lookup" type="entity_lookup"/>
                                    <action id="clear" type="entity_clear"/>
                                </actions>
                            </entityComboBox>
                            <hbox width="100%" id="twoFieldsHbox" caption="combined fields">
                                <dateField id="dateField" property="detailDate" />
                                <timeField id="timeField" dataContainer="detailsDc" property="detailTime"/>
                            </hbox>
                        </column>

Hi,

The FormLayout component doesn’t have data binding as it’s only designed for layouting. In order to reduce amount of XML code we added the dataContainer attribute to its XML markup. So, this attribute is handled only by XML loaders and the algorithm is the following: any field component that supports data binding and has the property attribute defined looks for dataContainer in its element or the most top parent element (e.i. component element, column doesn’t count). By design, we don’t go any further than most top parent element in order to prevent any false data bindings.

In your case, since you wrapped your fields with hbox, it’s up to you to define the correct dataContainer.

Regards,
Gleb

Thank you, Gleb. I had the misconception that the form element was no layout but more of a data thing. Using the dataContainer attribute there now seems a big dangerous since one day someone might decide to change the layout by adding hbox elements and by that break data binding without noticing it. Maybe you could somehow mark problematic properties in the XML? But I will just keep it in mind for now. Thanks!