0

the onCreate() problem

asked 2010-11-15 05:44:51 +0800

xiaohongboabcd gravatar image xiaohongboabcd
78 1

Test.zul:

<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
	<window title="new page title" border="normal" use="TestWindow" width="100%" height="100%">
		
		<borderlayout>
			<north>
				<button label="点击" forward="onClick=onTest"/>
			</north>
			<center >
				<include id="include"/>
			</center>
			<south height="50%">333</south>
		</borderlayout>
	</window>
</zk>

index.zul:
<zk>
	<window use="CenterWindow">
		<tree id="tree" width="300px" height="500px">
		</tree>
	</window>
</zk>

TestWindow.java:
public class TestWindow  extends Window{
	
	public void onCreate(){
		System.out.println("执行包含页面的初始化");
	}
	
	public void onTest(Event evnet){
		Include include = (Include) this.getFellow("include");
		include.setSrc("index.zul");
	}
}

CenterWindow.java:
public class CenterWindow extends Window {
	
	public void onCreate(){
		System.out.println("执行被包含页面的初始化函数");
	}
}

why the public void onCreate(){
System.out.println("执行被包含页面的初始化函数");
}
will run twice when chick the button?
Thanks!

delete flag offensive retag edit

3 Replies

Sort by » oldest newest

answered 2010-11-16 07:07:13 +0800

zippy gravatar image zippy
504 2

i dont know, but try to use doAfterCompose();

link publish delete flag offensive edit

answered 2011-01-03 10:32:53 +0800

yagamipaul gravatar image yagamipaul
15 2

Hi, i'm having the same problem, did you managed to find an answer?, how about using Executions api?
http://www.zkoss.org/forum/listComment/14652

, i haven't tried but it's the only alternative that i could find.

link publish delete flag offensive edit

answered 2011-02-09 19:21:16 +0800

ashishd gravatar image ashishd flag of Taiwan
1972 6

Hi xiaohongboabcd,
I couldn't reproduce your problem. I tested with latest ZK freshly. Have you managed to resolve your issue yet?

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-11-15 05:44:51 +0800

Seen: 302 times

Last updated: Feb 09 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More