A label can be bound with some web actions. This allows you to customize a label to make it respond to some events, and execute corresponding actions, such as sorting and filtering. For example, you can insert a label in JReport Designer and associate an action with the label's onclick event. Then, when you view the report at runtime and click the label, the defined operation will be executed.
The following table lists the events that can be used to trigger web actions:
| Events | Description |
|---|---|
| Blur | Fires when the object loses the input focus. |
| Data Change | Fires when the contents of the object or selection have changed. |
| Click | Fires when the user clicks the left mouse button on the object. |
| onContextMenu | Fires when the user clicks the right mouse button on the object, opening the shortcut menu. |
| Double_Click | Fires when the user double-clicks the object. |
| Focus | Fires when the object receives focus. |
| Key Down | Fires when the user presses a key. |
| Key Press | Fires when the user presses an alphanumeric key. |
| Key Up | Fires when the user releases a key. |
| Mouse Down | Fires when the user clicks the object with either mouse button. |
| Mouse Move | Fires when the user moves the mouse over the object. |
| Mouse Out | Fires when the user moves the mouse pointer outside the boundaries of the object. |
| Mouse Over | Fires when the user moves the mouse pointer into the object. |
| Mouse Up | Fires when the user releases a mouse button while the mouse is over the object. |
| Resize | Fires when the size of the object is about to change. |
| Scroll | Fires when the user repositions the scroll box in the scrollbar on the object. |
| Select | Fires when the current selection changes. |
To bind some web actions to a label:
that appears in the text box.Note: Web actions are not supported on web reports, and the Property and SendMessage web actions are available to library components only at present.
in the Display Type dialog and repeat Step 3 and 4 to add more web actions. If a web action is not required, click
to remove it.
or
. Then, when an event that has been bound with more than one action happens, the upper action will be triggered first.Then, at runtime, when any of the specified events occurs on the label, the web action defined on the event will be triggered.
The Filter web action enables you to filter the records in a data component.
To bind the Filter web action to a label:
to add a new filter condition.
To delete a filter condition, select it and click
. To adjust the order of the filter conditions, click
or
.
At runtime, when the specified event occurs on the label, the selected data component will be filtered based on the predefined conditions.
The Sort web action enables you to sort the records in a data component.
To bind the Sort web action to a label:
to add a new sort condition.
To delete a sort condition, select it and click
. To adjust the order of the sort conditions, click
or
.
At runtime, when the specified event occurs on the label, the selected data component will be sorted based on the predefined conditions.
The Parameter web action enables you to run a report, especially a report with parameters.
To bind the Parameter web action to a label:
At runtime, when the specified event occurs on the label, the selected report will run using the specified parameter values.
The Property web action enables you to make the properties of an object changed at runtime, however, it is available to the following objects in library components only: fields and labels in tables/crosstabs, some chart elements such as legend, chart axis and so on, markers and areas in geographic maps, as well as labels, parameter controls and the Submit buttons of parameter form controls which are not in the library components' configuration panels.
To bind the Property web action to a label:
to add a new line to change a property.
To delete a property line, click
. To adjust the order of the properties, click
or
.
At runtime, when the specified event occurs on the label, the property values will be applied to the selected object.
The SendMessage web action enables you to send out a message when a specific event occurs on a certain object in a library component. For more details about this web action, refer to Sending out messages.
Note: You can define your own web actions by adding API functions into both the file API.js located at <designer_install_root>\lib\html\javascript\dhtml and the same-name file located at <server_install_root>\public_html\dhtmljsp\js.