forward"

From Documentation
m
Line 29: Line 29:
  
 
The target component and the event data can be specified in EL expressions, while the event names cannot.
 
The target component and the event data can be specified in EL expressions, while the event names cannot.
 +
 +
Target component can also be specified using component [http://books.zkoss.org/wiki/ZK_Developer's_Guide/ZK_in_Depth/Component_Path_and_Accesibility/Access_UI_Component Path] within ZUML page. This is especially useful if target component is in different [http://books.zkoss.org/wiki/ZK_Developer's_Reference/UI_Composing/ID_Space IdSpace]
 +
<source lang="xml" >
 +
  <button forward="//mainPage/mainWindow.onSave" /> <!-- default forward event is onClick -->
 +
</source>
  
 
=Version History=
 
=Version History=

Revision as of 02:44, 7 July 2011

Syntax:

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 ForwardEvent.getOrigin(). 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.

You could specify any application-specific data in the forward condition by surrunding it with the parenthesis as shown below.

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

Then, the application-specific data can be retrieved by use of ForwardEvent.getData().

If you want to forward several events, you can specify all 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.

Target component can also be specified using component Path within ZUML page. This is especially useful if target component is in different IdSpace

   <button forward="//mainPage/mainWindow.onSave" /> <!-- default forward event is onClick -->

Version History

Version Date Content
     



Last Update : 2011/07/07

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