Есть сущность
@JmixEntity
@Table(name = "JT_TEST_ENTITY")
@Entity(name = "jt_TestEntity")
open class TestEntity {
....
@Composition
@OneToMany(mappedBy = "testEntity")
var childs: MutableList<TestChild> = NotInstantiatedList()
}
Редактор
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<view xmlns="http://jmix.io/schema/flowui/view"
title="msg://testEntityDetailView.title"
focusComponent="form">
<data>
<instance id="testEntityDc"
class="com.company.test.entity.TestEntity">
<fetchPlan extends="_base">
<property name="childs" fetchPlan="_base"/>
</fetchPlan>
<loader id="testEntityDl"/>
<collection id="childsDc" property="childs"/>
</instance>
</data>
<facets>
<dataLoadCoordinator auto="true"/>
</facets>
<actions>
<action id="saveAction" type="detail_saveClose"/>
<action id="saveWithoutCloseAction" type="detail_save"/>
<action id="closeAction" type="detail_close"/>
</actions>
<layout>
<formLayout id="form" dataContainer="testEntityDc">
<textField id="nameField" property="name"/>
<checkbox id="boolVarField" property="boolVar"/>
</formLayout>
<h4 text="msg://com.company.test.entity/TestEntity.childs"/>
<hbox id="buttonsPanel" classNames="buttons-panel">
<button action="childsDataGrid.create"/>
<button action="childsDataGrid.edit"/>
<button action="childsDataGrid.remove"/>
</hbox>
<dataGrid id="childsDataGrid" dataContainer="childsDc" width="100%" minHeight="20em">
<actions>
<action id="create" type="list_create">
<properties>
<property name="openMode" value="DIALOG"/>
</properties>
</action>
<action id="edit" type="list_edit">
<properties>
<property name="openMode" value="DIALOG"/>
</properties>
</action>
<action id="remove" type="list_remove"/>
</actions>
<columns>
<column property="orderPosition"/>
<column property="name"/>
</columns>
</dataGrid>
<hbox id="detailActions">
<button id="saveAndCloseBtn" action="saveAction"/>
<button id="saveBtn" action="saveWithoutCloseAction"/>
<button id="closeBtn" action="closeAction"/>
</hbox>
</layout>
</view>
Если у сущности есть childs
у таблицы childsDataGrid
Стоит сортировка. То при сохранении она сбрасывается.
До сохранения:
После:
jmix 2.3.4