我在使用 ViewModel 的 zul 文件中有一个按钮。我需要根据使用不同 ViewModel 的其他 zul 中的数据状态禁用/启用此按钮。第一个 ZUL 文件:
<window apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('First VM')" validationMessages="@id('vmsgs')">
<tabbox>
<tabs>
<tab label="Label Value" />
</tabs>
<tabpanels>
<tabpanel>
<include someparameter="${some_VM_model_object}" src="ZUL2"></include>
</tabpanel>
</tabpanels>
</tabbox>
<button label="My Button" onClick="" id="mybutton" visible="false" />
</window>
现在还有另一个 ZUL 文件,以及它对应的 VM(假设它的 VM 是 Second VM)第二个 VM:
@AfterCompose
public void afterCompose(@ContextParam(ContextType.VIEW) Component view) {
/*In this aftercompose method I want to check some condition on the model of the
second zul file and depending on that I want to disable/enable the "My Button"
button in the first ZUL*/
}
第一个 zul 和第二个 zul 可以有多个实例,但相关的可以通过 ViewModel 中的一些公共数据成员(在包含组件中作为“某些参数”传递)对象来识别。这在 ZK 中是否可能或任何有助于实现这一目标的方法?