index.zul
<?page id="foo"?> <zk> <include id="header" mode="defer" src="/template/header.zul" /> <include id="mainView" mode="defer" src="/discussion/list.zul" /> </zk>
list.zul
<div sclass="container" vflex="9" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('com.vm.DiscussionListViewModel')">
........
<button onClick="@command('Change')"/>
</div>
DiscussionListViewModel.java
@Command
public void buttonClick!() {
Include i = (Include) Path.getComponent("//foo/mainView");
i.setSrc("change.zul");
}
It will occur UI can't be modified problem, because of composer died before event finished.You cannot change "include component" by the composers which are included in the "include component"
Rendering Phase:
The Rendering PhaseAfter all events are processed, ZK renders these components into a regular HTML page and sends this page to the browser.
Reference: [1]http://books.zkoss.org/wiki/ZK_Developer's_Guide/Fundamental_ZK/Basic_Concepts/Architecture_Overview
No comments:
Post a Comment