Entity in main window

Hi,

I’ve seen somewhere that it’s possible to add fields of an entity in the main window, but i can’t find it anymore. I have an entity named “companyInfo” and i want to display its content in the main window.

can someone please point me in the right direction?

thanks

LS

Hi.
You need to extend the Main screen in your project, you can simply do it from CUBA Studio.

After screen extension, add necessary data component and then add UI components to Initial Layout to display the information you need. Do not forget to bound UI components with the data component.

For example, I want to display a table with Door entity instance, so I add the following code to ext-main-screen.xml

<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
        caption="mainMsg://application.caption">
    <data>
        <collection id="doorsDc" class="com.company.dmo.entity.Door">
            <view extends="_local"/>
            <loader id="doorsDl">
                <query>
                    <![CDATA[select e from dmo_Door e]]>
                </query>
            </loader>
        </collection>
    </data>
   ...
            <workArea id="workArea"
                      stylename="c-workarea"
                      height="100%">
                <initialLayout spacing="true" margin="true">
                    <label value="This is the work area - central part of the screen.
                    Put your components here."/>
                    <groupTable id="doorsTable" height="200px" width="100%" dataContainer="doorsDc">
                        <columns>
                            <column id="description"/>
                            <column id="isOpened"/>
                            <column id="color"/>
                            <column id="number"/>
                        </columns>
                    </groupTable>
                </initialLayout>
            </workArea>
        </cssLayout>
    </layout>
</window>

If you use platform version 7.+, also add @LoadDataBeforeShow annotation to ExtMainScreen controller.

Regards,
Natalia

thanks natalia i forgot to mention that the mainWindow is cuba 6. And the Entity has a dataSource not a dataContainer.

ls

Actions will be similar to those described above.

I just created a new screen (cuba 7) that solved the problem.

Many thanks Natalia