forward"

From Documentation
Line 35: Line 35:
  
  
 
+
= Description =
 
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 <javadoc>org.zkoss.zk.ui.event.ForwardEvent</javadoc> class. you can invoke <javadoc method="getOrigin()">org.zkoss.zk.ui.event.ForwardEvent</javadoc>. to retrieve the original event.
+
The event listener receives a <javadoc>org.zkoss.zk.ui.event.ForwardEvent</javadoc> object. You can invoke <javadoc method="getOrigin()">org.zkoss.zk.ui.event.ForwardEvent</javadoc> to retrieve the original event.
 
 
 
 
 
 
  
 
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.

Revision as of 07:50, 30 April 2020

Syntax

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

orginalEvent

Optional. If it is not specified, onClick is assumed

targetId1

Optional. If it's not specified, the space owner is assumed.

eventData

Optional. You could specify any application-specific data in the forward condition by surrounding 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 the use of ForwardEvent.getData().


Multiple forwarding

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"/>


Description

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 event listener receives a ForwardEvent object. You can invoke ForwardEvent.getOrigin() to retrieve the original event.

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

The 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 : 2020/04/30

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