Hi Natalia,
thanks for your attention.
Find attached the controller and descriptor of the user case I am trying to solve. This is part of an essay in developing the logic of an accounting application. It’s in spanish. But language will not play any role in our discussion.
AsientoEdit.java (4.9 KB)
and the descriptor code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://jmix.io/schema/ui/window"
caption="msg://asientoEdit.caption"
focusComponent="form">
<data>
<instance id="asientoDc"
class="contabilidad.entity.Asiento">
<fetchPlan extends="_base">
<property name="ejercicio" fetchPlan="_base"/>
<property name="movtosIva" fetchPlan="_base"/>
<property name="movtosIrpf" fetchPlan="_base">
<property name="asiento" fetchPlan="_base"/>
</property>
<property name="apuntes" fetchPlan="_base">
<property name="cuentaContable" fetchPlan="_base"/>
<property name="asiento" fetchPlan="_base"/>
</property>
</fetchPlan>
<loader/>
</instance>
<collection id="apuntesDebeDc" class="contabilidad.entity.Apunte">
<fetchPlan extends="_base"/>
<loader id="apuntesDebeDl">
<query>
<![CDATA[select e from contabi_Apunte e]]>
</query>
</loader>
</collection>
<collection id="apuntesHaberDc" class="contabilidad.entity.Apunte">
<fetchPlan extends="_base"/>
<loader id="apuntesHaberDl">
<query>
<![CDATA[select e from contabi_Apunte e]]>
</query>
</loader>
</collection>
<collection id="movtoIvasDc" class="contabilidad.entity.MovtoIva">
<fetchPlan extends="_base"/>
<loader id="movtoIvasDl">
<query>
<![CDATA[select e from contabi_MovtoIva e]]>
</query>
</loader>
</collection>
<collection id="movtoIrpfsDc" class="contabilidad.entity.MovtoIrpf">
<fetchPlan extends="_base"/>
<loader id="movtoIrpfsDl">
<query>
<![CDATA[select e from contabi_MovtoIrpf e]]>
</query>
</loader>
</collection>
</data>
<facets>
<dataLoadCoordinator auto="true"/>
<screenSettings id="settingsFacet" auto="true"/>
</facets>
<actions>
<action id="windowCommitAndClose" caption="msg:///actions.Ok"
icon="EDITOR_OK"
primary="true"
shortcut="${COMMIT_SHORTCUT}"/>
<action id="windowClose"
caption="msg:///actions.Close"
icon="EDITOR_CANCEL"/>
</actions>
<dialogMode height="600"
width="800"/>
<layout spacing="true" expand="scrollBox" width="100%">
<scrollBox id="scrollBox" spacing="true" width="100%">
<form id="form" dataContainer="asientoDc" width="100%">
<column width="100%">
<entityPicker enable="false" id="ejercicioField" property="ejercicio">
<actions>
<action id="entityLookup" type="entity_lookup"/>
<action id="entityClear" type="entity_clear"/>
</actions>
</entityPicker>
<textField id="numAsientoField" property="numAsiento"/>
<dateField id="fechaField" property="fecha"/>
<textArea width="100%" id="descripcionField" property="descripcion"/>
<label value="Apuntes"/>
<hbox spacing="true" width="100%">
<dataGrid editorBuffered="false" id="apuntesTableDebe" height="300px" width="100%" dataContainer="apuntesDebeDc">
<columns>
<column id="importe" property="importe" expandRatio="30"/>
<column id="cuentaContable" property="cuentaContable" expandRatio="70">
<htmlRenderer nullRepresentation="null"/>
</column>
</columns>
</dataGrid>
<dataGrid editorBuffered="false" id="apuntesTableHaber" height="300px" width="100%" dataContainer="apuntesHaberDc">
<columns>
<column id="cuentaContable" property="cuentaContable" expandRatio="70">
<htmlRenderer nullRepresentation="null"/>
</column>
<column id="importe" property="importe" expandRatio="30"/>
</columns>
</dataGrid>
</hbox>
<label value="Movimientos de IVA"/>
<table id="movtoIvasTable" height="100px" width="100%" dataContainer="movtoIvasDc">
<columns>
<column id="nif"/>
<column id="nombre"/>
<column id="fecha"/>
<column id="numFra"/>
<column id="importeBase"/>
<column id="tipoPorcentaje"/>
<column id="cuota"/>
</columns>
</table>
<label value="Movimientos de IRPF"/>
<table id="movtoIrpfsTable" height="100px" width="100%" dataContainer="movtoIrpfsDc">
<columns>
<column id="nif"/>
<column id="nombre"/>
<column id="fecha"/>
<column id="numFra"/>
<column id="base"/>
<column id="tipoPorcentaje"/>
<column id="cuota"/>
</columns>
</table>
</column>
</form>
</scrollBox>
<hbox id="editActions" spacing="true">
<button id="commitAndCloseBtn" action="windowCommitAndClose"/>
<button id="closeBtn" action="windowClose"/>
</hbox>
</layout>
</window>
So basically I display two tables that hold records of the same entity type. They consist of two columns, one of them has a basic numeric text editor, but the other one a combobox where I choose another entity type instance, that is a related entity to the one being edited in the table. I need to set a column generator and editor for that column, but since I have these two tables I am having issued displaying the editor and renderer for both tables. I have reached it getting to work properly if eliminating one of the two tables.
a possible solution would be to create different entity versions corresponding to each of the table. But that’s not very concordant with the data model and efficiency in data model design.
Any solutions? If you wish I can upload the project.
Regards,
Carlos.