0

jquery functions in composite component

asked 2011-12-15 10:37:38 +0800

jaan gravatar image jaan
88 3

Hi,

I've created a composite component (statusMessage)
This is my zul file:

<?page title="" contentType="text/html;charset=UTF-8"?>
<zk>
	<div
		style="position: absolute; border:solid 1px #333; background:#00b; 
				color:#000;top:10px;left:50%;margin-left:-50px;width:100px; z-index:99999;text-align:center;"
		xmlns:w="http://www.zkoss.org/2005/zk/client" >
		<label id="lblStatus" />
		<attribute w:name="setVisible">
			function (value) { 
				var sm = this; 
				if(value) {
					jq(sm).fadeIn('fast'); 
					setTimeout(function() { jq(sm).fadeOut('slow') } , 3000); 
				} 
			}
		</attribute>
	</div>
</zk>

The javaclass that create this component:

public class StatusMessage extends Div implements IdSpace {
	private static final long serialVersionUID = 5994732340875475703L;
	/***************** WIRED ************************/
	private Label lblStatus;
	
	/******* C'tor *************************/
	public StatusMessage() {
		Executions.createComponents("/WEB-INF/composite/statusmessage.zul", this, null);
		Components.wireVariables(this, this, '$', true, true);
		Components.addForwards(this, this, '$');
	}
	
	/******* Properties*********************/
	public String getValue() {
		return lblStatus.getValue();
	}
	public void setValue(String value) {
		this.lblStatus.setValue(value);
	}
}

I've added the component to lang-addon.xml so I can call <statusmessage value="blablabla" />

I can let the statusmessage appear by changing visibility (in zk 6: visible="@load(not empty vm.statusMessage)" )
But the jquery function to fadeout the message does not work.

If I use the same code directly in my page (the content of the zul file) the div is dissapearing as expected.
What am I doing wrong?

jaan

delete flag offensive retag edit
Be the first one to reply this discussion!
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: 2011-12-15 10:37:38 +0800

Seen: 317 times

Last updated: Dec 15 '11

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