主表使用这样的结构
@Column(name = "TAG_CODE")
private String tagCode;
@Transient
private DictEntity tagDict;
然后在 Loading和Saving事件中自己管理加载tagDict实体。
界面上选中 tagDict实体后,将code写入 tagCode 字段。
主表使用这样的结构
@Column(name = "TAG_CODE")
private String tagCode;
@Transient
private DictEntity tagDict;
然后在 Loading和Saving事件中自己管理加载tagDict实体。
界面上选中 tagDict实体后,将code写入 tagCode 字段。
好像不行,这个方案我之前也试过。
给TagDict 属性加上 @JmixProperty
注解
通过这种方式,后台去加载。并且为了显示dict的name加了aaa栏位的columngennerator。但是列表页进去走完init(dc正确的设完值)就报错了。
xml代码
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://jmix.io/schema/ui/window"
xmlns:c="http://jmix.io/schema/ui/jpql-condition"
caption="msg://AEntityBrowse.caption"
focusComponent="aEntitiesTable">
<data readOnly="true">
<collection id="aEntitiesDc"
class="com.company.jmixpm.entity.AEntity">
<fetchPlan extends="_base">
<property fetchPlan="_base" name="language"/>
<property name="tagDict" fetchPlan="_base"/>
</fetchPlan>
<loader id="aEntitiesDl">
<!-- <query>-->
<!-- <![CDATA[select e from AEntity e]]>-->
<!-- </query>-->
</loader>
</collection>
</data>
<facets>
<dataLoadCoordinator auto="true"/>
<screenSettings id="settingsFacet" auto="true"/>
</facets>
<actions>
<action id="lookupSelectAction"
caption="msg:///actions.Select"
icon="LOOKUP_OK"
primary="true"
shortcut="${COMMIT_SHORTCUT}"/>
<action id="lookupCancelAction"
caption="msg:///actions.Cancel"
icon="LOOKUP_CANCEL"/>
</actions>
<dialogMode height="600"
width="800"/>
<layout expand="aEntitiesTable" spacing="true">
<filter id="filter"
dataLoader="aEntitiesDl">
<properties include=".*"/>
</filter>
<table id="aEntitiesTable"
width="100%"
dataContainer="aEntitiesDc">
<actions>
<action id="create" type="create"/>
<action id="edit" type="edit"/>
<action id="remove" type="remove"/>
</actions>
<columns>
<column id="code"/>
<column id="name"/>
<column id="aaaa"/>
<column id="language"/>
</columns>
<simplePagination/>
<buttonsPanel id="buttonsPanel"
alwaysVisible="true">
<button id="createBtn" action="aEntitiesTable.create"/>
<button id="editBtn" action="aEntitiesTable.edit"/>
<button id="removeBtn" action="aEntitiesTable.remove"/>
</buttonsPanel>
</table>
<hbox id="lookupActions" spacing="true" visible="false">
<button action="lookupSelectAction"/>
<button action="lookupCancelAction"/>
</hbox>
</layout>
</window>
错误是这行引起的,这个facet的作用是自动运行DL,所以手动加载数据的时候要去掉。
列表这样处理ok了。同时带来两个问题。
(1)filter
(2)分页
这两块是不是又得单独处理了?