Client-side Firing"

From Documentation
m
Line 20: Line 20:
  
 
#The widget has a peer component, i.e., the widget was created by ZK Client Engine because of the instantiation of a component at the server. Notice that, to minimize the traffic, ZK Client Engine sends the AU request only if one of the following conditions is satisfied:
 
#The widget has a peer component, i.e., the widget was created by ZK Client Engine because of the instantiation of a component at the server. Notice that, to minimize the traffic, ZK Client Engine sends the AU request only if one of the following conditions is satisfied:
#*The event is declared as an important event.
+
#*The event is declared as [[ZK Client-side Reference/Communication/AU Requests/Server-side Processing#Important_Events|an important event]].
 
#*The server has registered an event listener (<javadoc type="interface">org.zkoss.zk.ui.event.EventListener</javadoc> for it.
 
#*The server has registered an event listener (<javadoc type="interface">org.zkoss.zk.ui.event.EventListener</javadoc> for it.
 
#Or, the <tt>toServer</tt> option has been specified in <javadoc directory="jsdoc" method="opts">zk.Event</javadoc> of the event.
 
#Or, the <tt>toServer</tt> option has been specified in <javadoc directory="jsdoc" method="opts">zk.Event</javadoc> of the event.

Revision as of 04:48, 17 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, until all ancestors are notified, or the propagation has been stopped by Event.stop(Map).

After the widget and all of its ancestors are notified, this event is converted to an AU request and sent to the server, if

  1. The widget has a peer component, i.e., the widget was created by ZK Client Engine because of the instantiation of a component at the server. Notice that, to minimize the traffic, ZK Client Engine sends the AU request only if one of the following conditions is satisfied:
  2. Or, the toServer option has been specified in Event.opts of the event.

Fire Event to Desktop

Fire Event Directly to Server

Version History

Last Update : 2010/12/17


Version Date Content
     



Last Update : 2010/12/17

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