 |
Control API for List Box (listBox)
A set of choices from which a user can select one items. If the number
of text lines exceeds the control size, a vertical scrollbar is activated.
An item in the listBox is called listBoxItem. ListBoxItems are explained
above - after the dropdownListBox description.
- disabled
A boolean value that defines if the
listBox is clickable. If the listBox is disabled it is not selectable.
A disabled listBox has a different color for the displayed listBoxItem.
- id
Identification name of the listBox.
- model
Defines the model which provides the listBox with data.
- nameOfKeyColumn
Specifies the name of the column that
contains the key. This is used when you use an underlying table in the
model.
- nameOfValueColumn
Specifies the name of the column that
contains the visible text. This is used when you use an underlying table
in the model.
- onSelect
Defines the action that will be processed
when the user clicks on the enabled listBox. If you do not define
a 'onSelect' event the listBox
can be clicked but no event is generated.
- onClientSelect
Defines the JavaScript fragment that is
executed when the user clicks on the listBox. If both events ('onClick'
and 'onClientSelect') are specified, the 'onClientSelect' event is activated
first. By default the 'onClick' event is activated afterwards. In the
JavaScript fragment you can cancel the activation of the 'onClick' event
with the command
htmlbevent.cancelSubmit=true;
The 'onClientSelect' event is very useful to save client/server interaction.
Example
A listbox click usually activates
the client/server interaction. If an input field has to be filled out
for further processing, the JavaScript fragment can check the necessary
input on the client side and display a message if the necessary input
is missing, without server interaction.
Note
To use JavaScript the JSP has to use the page
tag (see page tag).
- selection
Specifies the key of the listBoxItem which is displayed in the listBox.
- Size
Sets the number of lines displayed for the listBox. If the number
of text lines for listBox is higher then the size attribute a vertical
scrollbar is activated - the width of the listBox is not changed, the
text display window becomes smaller.
- tooltip
Defines the hint of the listBox which
is displayed as the mouse cursor passes over the listBox, or
as the mouse button is pressed but not released.
- width
Defines the width of the listBox.
Text lines are truncated if the length of the string extends the width.
| attribute |
req. |
values |
default |
case sens. |
JSP taglib |
classlib |
| disabled |
no |
TRUE
FALSE |
FALSE |
yes |
disabled="TRUE" |
setDisabled(true) |
| id |
yes |
String |
none |
yes |
id="listbox_te" |
|
| model |
no |
String |
none |
yes |
model="myBean.model" |
setModel((IlistModel) model) |
| nameOfKeyColumn |
no |
String |
none |
no |
nameOfKeyColumn("k1") |
setNameOfKeyColumn("k1") |
| nameOfValueColumn |
no |
String |
none |
no |
nameOfValueColumn("v1") |
setNameOfValueColumn("v1") |
| selection |
no |
String |
none |
yes |
selection("HD") |
setSelection("HD") |
| size |
no |
Numeric |
4 |
- |
size="10" |
setSize(10) |
| tooltip |
no |
String |
none |
no |
tooltip="select
a item" |
setTooltip("select
a item") |
| width |
no |
Unit |
max. item length |
- |
width="100" |
setWidth("100") |
| events |
req. |
values |
default |
case sens. |
JSP taglib |
classlib |
| onClientSelect |
no |
String |
none |
yes |
onClientSelect="JavaScript" |
setOnClientSelect("JavaScript") |
| onSelect |
no |
String |
none |
yes |
onSelect="proc_listbox" |
setOnSelect("proc_listbox") |
listBoxItem
Defines the items in a dropdownListBox or listBox instead of the model.
See dropdownListBox.
Example
<hbj:listBox
id="LB_CitiesNearby"
tooltip="Cities surounding SAP"
selection="WD"
disabled="false"
nameOfKeyColumn="KeyCol"
nameOfValueColumn="KeyVal"
onSelect="ProcessCity"
onClientSelect="PreprocessCity"
>
<hbj:listBoxItem
key="HD"
value="Heidelberg"
selected="true"
/>
<hbj:listBoxItem
key="HK"
value="Hockenheim"
/>
<hbj:listBoxItem
key="WD"
value="Walldorf"
selected="true"
/>
<hbj:listBoxItem
key="WL"
value="Wiesloch"
/>
</hbj:listBox>
Result

|
|