I get an error when the screen opens.
IllegalStateException: Cannot get unfetched attribute [genericFileDefinition] from detached object com.ferda.enterprisesecvis.entity.GenericFileElement-0047a204-4365-b226-50a3-a662955855ad [detached].
I looked at the docs. It says that i should create a view including parent element for the child and use that view in ds of child element. I already did that.
When I create new child element i can create the record correctly (with parent element and other fields).
This is the code for the screen
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/window.xsd"
caption="msg://caption"
class="com.ferda.enterprisesecvis.web.genericfileelement.GenericFileElementBrowse"
focusComponent="genericFileElementsTable"
lookupComponent="genericFileElementsTable"
messagesPack="com.ferda.enterprisesecvis.web.genericfileelement">
<dsContext>
<datasource id="genericFileElementDs"
class="com.ferda.enterprisesecvis.entity.GenericFileElement"
view="genericFileElement-view"/>
<groupDatasource id="genericFileElementsDs"
class="com.ferda.enterprisesecvis.entity.GenericFileElement"
view="genericFileElement-view">
<query>
<![CDATA[select e from enterprisesecvis$GenericFileElement e]]>
</query>
</groupDatasource>
</dsContext>
<actions>
<action id="save"
caption="mainMsg://actions.Ok"
icon="icons/ok.png"
invoke="save"
shortcut="CTRL-ENTER"/>
<action id="cancel"
caption="mainMsg://actions.Cancel"
icon="icons/cancel.png"
invoke="cancel"/>
</actions>
<dialogMode height="600"
width="800"/>
<layout>
<split id="split"
height="100%"
orientation="horizontal"
reversePosition="true"
width="100%">
<vbox id="lookupBox"
height="100%"
margin="false,true,false,false"
spacing="true">
<filter id="filter"
applyTo="genericFileElementsTable"
datasource="genericFileElementsDs">
<properties include=".*"/>
</filter>
</vbox>
<vbox id="editBox"
expand="fieldGroupBox"
height="100%"
spacing="true">
<vbox id="fieldGroupBox">
<fieldGroup id="fieldGroup"
datasource="genericFileElementDs">
<column width="250px">
<field property="name"/>
<field property="type"/>
<field property="parentName"/>
<field property="genericFileDefinition"/>
</column>
</fieldGroup>
<groupTable id="genericFileElementsTable"
height="100%"
width="100%">
<actions>
<action id="create"/>
<action id="edit"/>
<action id="remove"/>
</actions>
<columns>
<column id="name"/>
<column id="type"/>
<column id="parentName"/>
<column id="genericFileDefinition"/>
</columns>
<rows datasource="genericFileElementsDs"/>
<rowsCount/>
<buttonsPanel id="buttonsPanel"
alwaysVisible="true">
<button id="createBtn"
action="genericFileElementsTable.create"/>
<button id="editBtn"
action="genericFileElementsTable.edit"/>
<button id="removeBtn"
action="genericFileElementsTable.remove"/>
</buttonsPanel>
</groupTable>
</vbox>
<hbox id="actionsPane"
spacing="true"
visible="false">
<button id="saveBtn"
action="save"/>
<button id="cancelBtn"
action="cancel"/>
</hbox>
</vbox>
</split>
</layout>
</window>