Client-side Firing"

From Documentation
m
m
Line 1: Line 1:
 
{{ZKDevelopersReferencePageHeader}}
 
{{ZKDevelopersReferencePageHeader}}
 +
 +
__TOC__
 +
 
In general, an AU request is caused by a widget event (<javadoc directory="jsdoc">zk.Event</javadoc>) that is going to be sent to the server. It happens when a widget event is targeting a widget that is created at the server, or with the <tt>toServer</tt> option (specified in <javadoc directory="jsdoc" method="opts">zk.Event</javadoc>).  In additions, you could invoke <javadoc method="fire()">_global_.zAu</javadoc> explicitly to fire an AU request to the server.  
 
In general, an AU request is caused by a widget event (<javadoc directory="jsdoc">zk.Event</javadoc>) that is going to be sent to the server. It happens when a widget event is targeting a widget that is created at the server, or with the <tt>toServer</tt> option (specified in <javadoc directory="jsdoc" method="opts">zk.Event</javadoc>).  In additions, you could invoke <javadoc method="fire()">_global_.zAu</javadoc> explicitly to fire an AU request to the server.  
  
 
=Fire Event to Widget=
 
=Fire Event to Widget=
  
An event can be fired to a widget by use of <javadoc method="fire(_global_.String, zk.Object, _global_.Map, int)" directory="jsdoc">zk.Widget</javadoc> and <javadoc method="fireX(zk.Event, int)" directory="jsdoc">zk.Widget</javadoc>.
+
An event can be fired to a widget by use of <javadoc method="fire(_global_.String, zk.Object, _global_.Map, int)" directory="jsdoc">zk.Widget</javadoc> and <javadoc method="fireX(zk.Event, int)" directory="jsdoc">zk.Widget</javadoc>. For example,
 +
 
 +
<source lang="javascript">
 +
onCloseClick: function () {
 +
this.fire('onClose');
 +
}
 +
</source>
 +
 
 +
The event will be ''propagated'' to the widget's parent, parent's parent and so on.
 +
[[zk.Widget#fire]] fires a client event (an instance of [[zk.Event]]), and the client event is converted to an AU request if all the following conditions are satisfied.
 +
 
 +
* The widget is a peer of a component, that is, it was created automatically to represent a component. Notice that [[zk.Widget#inServer|inServer]] indicates if a widget is a peer of a component.
 +
* The event propagation is not stopped (i.e., [[zk.Widget#stop]] not set.
 +
* The event is listened by a server-side listener (<code>org.zkoss.zk.ui.Listener</code>), or it is [[#Important Events|an important event]].
  
 
=Fire Event to Desktop=
 
=Fire Event to Desktop=

Revision as of 11:37, 14 December 2010

In general, an AU request is caused by a widget event (Event) that is going to be sent to the server. It happens when a widget event is targeting a widget that is created at the server, or with the toServer option (specified in Event.opts). In additions, you could invoke Au.fire() explicitly to fire an AU request to the server.

Fire Event to Widget

An event can be fired to a widget by use of Widget.fire(String, Object, Map, int) and Widget.fireX(Event, int). For example,

onCloseClick: function () {
 this.fire('onClose');
}

The event will be propagated to the widget's parent, parent's parent and so on. zk.Widget#fire fires a client event (an instance of zk.Event), and the client event is converted to an AU request if all the following conditions are satisfied.

  • The widget is a peer of a component, that is, it was created automatically to represent a component. Notice that inServer indicates if a widget is a peer of a component.
  • The event propagation is not stopped (i.e., zk.Widget#stop not set.
  • The event is listened by a server-side listener (org.zkoss.zk.ui.Listener), or it is an important event.

Fire Event to Desktop

Fire Event Directly to Server

Version History

Last Update : 2010/12/14


Version Date Content
     



Last Update : 2010/12/14

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.