SelectEvent"

From Documentation
m (correct highlight (via JWB))
(13 intermediate revisions by 4 users not shown)
Line 13: Line 13:
  
 
= Example =
 
= Example =
 +
==Get Keys==
 +
It would be very helpful to add the getKeys() method of a MouseEvent to SelectEvents. For example, if you're using a listbox and want to detect if the CTRL key is being held when one of the listitems is selected.
  
N/A
+
[[Image:ZKComRef_SelectEvent_GetKeys.png]]
 +
<source lang="xml" highlight="3">
 +
<zk>
 +
<label id="i"/>
 +
<listbox onSelect='i.value = "keys: "+event.getKeys()'>
 +
<listhead>
 +
<listheader label="Population"/>
 +
<listheader label="%"/>
 +
</listhead>
 +
<listitem value="A">
 +
<listcell>a</listcell>
 +
<listcell label="20%"/>
 +
</listitem>
 +
<listitem value="B">
 +
<listcell>b</listcell>
 +
<listcell>c</listcell>
 +
</listitem>
 +
</listbox>
 +
</zk>
 +
</source>
  
 +
== Get the Previous Selected Items ==
 +
If user want to know which of the selected items are new added or removed, they can use the ''getPreviousSelectedItems'' method to filter out. (if model exists and in paging mold, it should return null)
 +
 +
== Get the Previous Selected Objects ==
 +
If user want to know which of the selected objects are new added or removed, they can use the ''getPreviousSelectedObjects'' method to filter out. The information is available only when the target component has a model.
 +
 +
*[since 7.0.1]
 +
 +
== Get the Unselected Items ==
 +
If user want to know which of the selected items are deselected, they can use the ''getUnselectedItems'' method to filter out. (if model exists and in paging mold, it should return null)
 +
 +
*[since 7.0.1]
 +
 +
== Get the Unselected Objects ==
 +
If user want to know which of the selected objects are deselected, they can use the ''getUnselectedObjects'' method to filter out. The information is available only when the target component has a model.
 +
 +
*[since 7.0.1]
  
 
=Supported events=
 
=Supported events=
  
{| border="1" | width="100%"
+
{| class='wikitable' | width="100%"
 
! <center>Name</center>
 
! <center>Name</center>
 
! <center>Event Type</center>
 
! <center>Event Type</center>
Line 33: Line 71:
 
=Use cases=
 
=Use cases=
  
{| border='1px' | width="100%"
+
{| class='wikitable' | width="100%"
 
! Version !! Description !! Example Location
 
! Version !! Description !! Example Location
 
|-
 
|-
Line 43: Line 81:
 
=Version History=
 
=Version History=
  
{| border='1px' | width="100%"
+
{| class='wikitable' | width="100%"
 
! Version !! Date !! Content
 
! Version !! Date !! Content
 
|-
 
|-
| 5.0.2
+
| 7.0.0
| 5/5/2010
+
| October, 2013.
| Initialization
+
| [http://tracker.zkoss.org/browse/ZK-1992 Multiple selection component(listbox, chosenbox) support extra information for find out added item/removed item]
 +
|-
 +
| 7.0.1
 +
| January 2014.
 +
| [http://tracker.zkoss.org/browse/ZK-2089 SelectEvent support get UnselectedItems]
 
|}
 
|}
  
 
{{ZKComponentReferencePageFooter}}
 
{{ZKComponentReferencePageFooter}}

Revision as of 09:23, 18 January 2022

SelectEvent

  • Demonstration: N/A
  • Java API: SelectEvent
  • JavaScript API: N/A

Employment/Purpose

Represents an event cause by user's the list selection is changed at the client.


Example

Get Keys

It would be very helpful to add the getKeys() method of a MouseEvent to SelectEvents. For example, if you're using a listbox and want to detect if the CTRL key is being held when one of the listitems is selected.

ZKComRef SelectEvent GetKeys.png

<zk>
	<label id="i"/>
	<listbox onSelect='i.value = "keys: "+event.getKeys()'>
		<listhead>
			<listheader label="Population"/>
			<listheader label="%"/>
		</listhead>
		<listitem value="A">
			<listcell>a</listcell>
			<listcell label="20%"/>
		</listitem>
		<listitem value="B">
			<listcell>b</listcell>
			<listcell>c</listcell>
		</listitem>
	</listbox>
</zk>

Get the Previous Selected Items

If user want to know which of the selected items are new added or removed, they can use the getPreviousSelectedItems method to filter out. (if model exists and in paging mold, it should return null)

Get the Previous Selected Objects

If user want to know which of the selected objects are new added or removed, they can use the getPreviousSelectedObjects method to filter out. The information is available only when the target component has a model.

*[since 7.0.1]

Get the Unselected Items

If user want to know which of the selected items are deselected, they can use the getUnselectedItems method to filter out. (if model exists and in paging mold, it should return null)

*[since 7.0.1]

Get the Unselected Objects

If user want to know which of the selected objects are deselected, they can use the getUnselectedObjects method to filter out. The information is available only when the target component has a model.

*[since 7.0.1]

Supported events

Name
Event Type
None None

Supported Children

*NONE

Use cases

Version Description Example Location
     

Version History

Version Date Content
7.0.0 October, 2013. Multiple selection component(listbox, chosenbox) support extra information for find out added item/removed item
7.0.1 January 2014. SelectEvent support get UnselectedItems



Last Update : 2022/01/18

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