I have a button in a zul file which is using a ViewModel. I need to disable/enable this button depending on the state of the data in some other zul which is using a different ViewModel. First ZUL file:
<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>
Now there is another ZUL file, and its corresponding VM(Let's say its VM is Second VM) Second 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*/
}
There can be multiple instances of the first zul as well as the second zul, but the related ones can identified through some common data member(which is being passed as "someparameter" in the include component) objects in the ViewModel. Is this possible in ZK or any approach that can help to achieve this ?