I have two tables (“Annotation”, “Alias”) and I am using split screen for both the tables on a single browser screen.
Both tables are related by many_to_one cardinality with annotation_id.
What I would like to do now is when I select the row on the upper half means annotation table I should see the data related to it on the second half from the alias table which have the same id.
Ex- when I select row 1 in annotation table, it should refer to the selected id and display all the related data in the alias table which refers to the same id.
I could do it with query but I want in such a way that it should update on row selection(single selection).
Please refer to the attached screenshot below.
Any suggestions will be appreciated.
Thanks,
Sanchit
browse-file:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/window.xsd"
caption="msg://browseCaption"
class="com.company.myproject.web.annotation.AnnotationBrowse"
focusComponent="AnnotationFieldDataGrid"
messagesPack="com.company.myproject.web.annotation">
<dsContext>
<collectionDatasource id="annotationsDs"
class="com.company.myproject.entity.Annotation"
view="_local">
<query>
<![CDATA[select e from myproject$Annotation e]]>
<filter>
<and>
<c>e.adSpace = :component$adSpaceSearch</c>
<c>e.type = :component$typeSearch</c>
<c>e.code = :component$codeSearch</c>
</and>
</filter>
</query>
</collectionDatasource>
<collectionDatasource id="annotationTypeDs"
class="com.company.myproject.entity.Annotation"
view="annotation-typeview">
<query>
<![CDATA[select e from myproject$Annotation e]]>
</query>
</collectionDatasource>
<collectionDatasource id="aliasesDs"
class="com.company.myproject.entity.Alias"
view="alias-view">
<query>
<![CDATA[select e from myproject$Alias e]]>
</query>
</collectionDatasource>
</dsContext>
<dialogMode height="600"
width="800"/>
<layout expand="split">
<groupBox id="groupBox"
orientation="horizontal"
spacing="true">
<lookupField id="adSpaceSearch"
caption="AdSpace Search"
captionProperty="adSpace"
inputPrompt="Select AdSpace"/>
<lookupField id="typeSearch"
caption="Type Search"
captionProperty="type"
inputPrompt="Select type"/>
<lookupField id="codeSearch"
caption="Code Search"
captionProperty="code"
inputPrompt="Select code"/>
</groupBox>
<split id="split"
orientation="vertical"
width="100%">
<dataGrid id="AnnotationFieldDataGrid"
datasource="annotationsDs"
editorEnabled="true"
height="100%"
reorderingAllowed="false"
width="100%">
<columns>
<column property="adSpace"/>
<column property="type"/>
<column property="code"/>
<column property="isBestselling"/>
<column property="created"/>
<column property="enabled"/>
<column property="updated"/>
<column property="id"/>
</columns>
<rowsCount/>
</dataGrid>
<dataGrid id="aliasdataGrid"
datasource="aliasesDs"
height="100%"
width="100%">
<columns>
<column property="annotation"/>
<column property="value"/>
<column property="label"/>
<column property="lang"/>
<column property="ambiguous"/>
<column property="created"/>
<column property="enabled"/>
<column property="updated"/>
<column property="id"/>
</columns>
</dataGrid>
</split>
</layout>
</window>