Всем привет такой вопрос! Какое событие отслеживает screen?
У меня например 2 открытые вкладки и если я перехожу на первую то окно должно обновится!
Я так предполагаю есть какое то событие и в нем можно будет просто вызвать например saleDl.load() и данные в окне обновятся
Это не то! )
Нужно вот это!
Когда вкладка со списком тех или иных документов становится активной, то мы перезагружаем список.
Далее
Далее
Вот такой вот вопрос!!!
Вот код из Дескриптора
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://jmix.io/schema/ui/window"
caption="msg://saleBrowse.caption"
focusComponent="documentsTable">
<data readOnly="true">
<collection id="salesDc"
class="com.advance.agent.entity.Sale">
<fetchPlan extends="_base">
<property name="company" fetchPlan="_base"/>
<property name="client" fetchPlan="_base"/>
<property name="clientContract" fetchPlan="_base"/>
<property name="storage" fetchPlan="_base"/>
<property name="salesRepresentative" fetchPlan="_base"/>
<property name="author" fetchPlan="_base"/>
</fetchPlan>
<loader id="salesDl">
<query>
<![CDATA[select e from Sale e order by e.date desc]]>
</query>
</loader>
</collection>
</data>
<facets>
<dataLoadCoordinator auto="true"/>
<screenSettings id="settingsFacet" auto="true"/>
<presentations auto="true"/>
<editorScreen id="editFacet" openMode="NEW_WINDOW" container="salesDc"
onAction="documentsTable.edit" listComponent="documentsTable" editMode="EDIT"/>
<editorScreen id="createFacet" openMode="NEW_WINDOW" container="salesDc"
onAction="documentsTable.create" listComponent="documentsTable" editMode="CREATE"/>
</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="documentsTable" spacing="true">
<filter id="filter"
dataLoader="salesDl" collapsed="true">
<properties include=".*"/>
</filter>
<groupTable id="documentsTable"
width="100%"
dataContainer="salesDc">
<actions>
<action id="create" type="create"/>
<action id="edit" type="edit"/>
<action id="refresh" type="refresh"/>
<action id="remove" type="remove"/>
</actions>
<columns>
<column id="documentState"/>
<column id="number"/>
<column id="date"/>
<column id="company"/>
<column id="client"/>
<column id="clientContract"/>
<column id="storage"/>
<column id="sum"/>
<column id="vatSum"/>
<column id="salesRepresentative"/>
<column id="note" maxTextLength="25"/>
<column id="author"/>
</columns>
<simplePagination/>
<buttonsPanel id="buttonsPanel"
alwaysVisible="true">
<button id="createBtn" action="documentsTable.create"/>
<button id="editBtn" action="documentsTable.edit"/>
<button id="refreshBtn" action="documentsTable.refresh"/>
<button id="removeBtn" action="documentsTable.remove"/>
</buttonsPanel>
</groupTable>
<hbox id="lookupActions" spacing="true" visible="false">
<button action="lookupSelectAction"/>
<button action="lookupCancelAction"/>
</hbox>
</layout>
</window>
Вообще у экрана нет такого слушателя (на скок я знаю). Можно воспользоваться советом sergeevms.33 и в MainScreen
достучаться до tabSheet
. Повесить там слушатель. Вопрос ток в том как там определить экран. Нужно будет посидеть в дебаге.
Спасибо! Буду смотреть!
Это точно не будет легкой прогулкой… Оно судя по всему сидит в ScreensImpl.class
, не уверен, что туда стоит лезть Опять же нужно какие-то global-ui-events (в кубе так назывались), кмк; есть ли они сейчас в jmix я не знаю.
Может быть разработчики платформы что-то дельное подскажут.
Это про tabSheet
? Его можно получить в MainScreen
из AppWorkArea
.
Скорее всего там будет что-то типа
val tabSheet = (workArea as AppWorkAreaImpl).tabbedWindowContainer as JmixMainTabSheet
tabSheet.addSelectedTabChangeListener {
if (it.component is Screen) {
// todo
}
}
UPD: с it.component is Screen
я переборщил. Скорее всего там какая-то обертка есть в которой экран лежит.