forward"

From Documentation
(Created page with '== The forward Attribute == forward="orginalEvent=targetId1/targetId2.targetEvent" forward="orginalEvent=targetId1/targetId2.targetEvent(eventData)" forward="originalEvent=${e…')
 
Line 7: Line 7:
 
It is used to forward an event, that is targeting a specific component, to another component in another event name. It is called the forward condition.
 
It is used to forward an event, that is targeting a specific component, to another component in another event name. It is called the forward condition.
  
The forward event is an instance of the <tt>org.zkoss.zk.ui.event.ForwardEvent</tt> class. you can invoke the <tt>getOrigin</tt> method to retrieve the original event.
+
The forward event is an instance of the <javadoc>org.zkoss.zk.ui.event.ForwardEvent</javadoc> class. you can invoke the <tt>getOrigin</tt> method to retrieve the original event.
  
 
The original event is optional. If it is omitted, <tt>onClick</tt> is assumed. Similarly, the target ID is also optional. If omitted, the space owner is assumed.
 
The original event is optional. If it is omitted, <tt>onClick</tt> is assumed. Similarly, the target ID is also optional. If omitted, the space owner is assumed.

Revision as of 04:43, 8 July 2010

The forward Attribute

forward="orginalEvent=targetId1/targetId2.targetEvent"
forward="orginalEvent=targetId1/targetId2.targetEvent(eventData)"
forward="originalEvent=${el-target}.targetEvent(${el-eventdata})"
forward="targetEvent"

It is used to forward an event, that is targeting a specific component, to another component in another event name. It is called the forward condition.

The forward event is an instance of the ForwardEvent class. you can invoke the getOrigin method to retrieve the original event.

The original event is optional. If it is omitted, onClick is assumed. Similarly, the target ID is also optional. If omitted, the space owner is assumed.

The data specified in the parenthesis is the application-specific data, which can be retrieved by calling the getData method.

 <button forward="onCancel(abort)"/><!-- "abort" is passed -->
 <button forward="onPrint(${inf})"/><!-- the object returned by ${inf} is passed -->

If you want to forward several events, you can specify these conditions in the forward attribute by separating them with the comma (,):

 <textbox forward="onChanging=onUpdating, onChange=some.onUpdate"/>

The target component and the event data can be specified in EL expressions, while the event names cannot.