DOM Events"

From Documentation
m
Line 2: Line 2:
  
 
__TOC__
 
__TOC__
There are two kinds of events at the client side: widget events (<javadoc directory="jsdoc">zk.Event</javadoc>) and DOM events (<javadoc directory="jsdoc">jq.Event</javadoc>).
+
There are two kinds of events at the client side: widget events (<javadoc directory="jsdoc">zk.Event</javadoc>) and DOM events (<javadoc directory="jsdoc">jq.Event</javadoc>). A widget event is triggered by a widget or an application, while a DOM event is triggered by the browser.
  
 
= Widget Events =
 
= Widget Events =
A widget event is the widget-level event that a widget can fire (<javadoc method="fire(_global_.String, zk.Object, _global_.Map, int)" directory="jsdoc">zk.Widget</javadoc>) and the client application can listen (<javadoc method="listen(_global_.Map, int)" directory="jsdoc">zk.Widget</javadoc>). Its role is similar to <javadoc>org.zkoss.zk.event.Event</javadoc> at the server side<ref>It is converted to an AU request (<javadoc type="interface">org.zkoss.zk.au.AuRequest</javadoc>) when arrives at the server. For more information, please refer to the [[ZK Client-side Reference/Communication/AU Requests|AU Requests]] section.</ref>.
+
A widget event is the widget-level event. Like <javadoc>org.zkoss.zk.event.Event</javadoc> at the server side, the widget event is usually triggered to a widget (and an application) to notify a widget-level event, such as a window has been moved.
 +
 
 +
A widget event will be ''propagated'' to the parent widget, parent's parent and so on, until stopped (<javadoc method="stop(_global_.Map)" directory="jsdoc">zk.Event</javadoc>). Then, if the event is required by the server, it will be sent to the server, and converted to an instance of <javadoc type="interface">org.zkoss.zk.au.AuRequest</javadoc> at the server<ref>For more information, please refer to the [[ZK Client-side Reference/Communication/AU Requests|AU Requests]] section.</ref>.
 +
 
 +
To fire a widget event, you could invoke <javadoc method="fire(_global_.String, zk.Object, _global_.Map, int)" directory="jsdoc">zk.Widget</javadoc> or <javadoc method="fireX(zk.Event, int)" directory="jsdoc">zk.Widget</javadoc>.
 +
 
 +
To listen a widget event, you could invoke <javadoc method="listen(_global_.Map, int)" directory="jsdoc">zk.Widget</javadoc>. Its
  
 
= DOM Events =
 
= DOM Events =
Line 12: Line 18:
 
== How to Listen and Unlisten ==
 
== How to Listen and Unlisten ==
 
== When to Listen and Unlisten ==
 
== When to Listen and Unlisten ==
<blockquote>
 
----
 
<references/>
 
</blockquote>
 
  
 
=Version History=
 
=Version History=

Revision as of 05:00, 20 December 2010


There are two kinds of events at the client side: widget events (Event) and DOM events (Event). A widget event is triggered by a widget or an application, while a DOM event is triggered by the browser.

Widget Events

A widget event is the widget-level event. Like Event at the server side, the widget event is usually triggered to a widget (and an application) to notify a widget-level event, such as a window has been moved.

A widget event will be propagated to the parent widget, parent's parent and so on, until stopped (Event.stop(Map)). Then, if the event is required by the server, it will be sent to the server, and converted to an instance of AuRequest at the server[1].

To fire a widget event, you could invoke Widget.fire(String, Object, Map, int) or Widget.fireX(Event, int).

To listen a widget event, you could invoke Widget.listen(Map, int). Its

DOM Events

A DOM event (Event) is the DOM-level event that is usually triggered by the browser. It is usually listened by the implementation of a widget, rather than the client application.

How to Listen and Unlisten

When to Listen and Unlisten

Version History

Last Update : 2010/12/20


Version Date Content
     



Last Update : 2010/12/20

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


  1. For more information, please refer to the AU Requests section.