SelectEvent"

From Documentation
 
(14 intermediate revisions by 3 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 users want to know which of the selected items are newly added or removed, they can use the ''getPreviousSelectedItems'' method to filter out. (if a model exists and is in paging mold, it should return null)
 +
 
 +
== Get the Previous Selected Objects ==
 +
{{versionSince| 7.0.1}}
 +
If users 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.
 +
 
 +
== Get the Unselected Items ==
 +
{{versionSince| 7.0.1}}
 +
If users want to know which of the selected items are deselected, they can use the ''getUnselectedItems'' method to filter out. (if a model exists and is in paging mold, it should return null)
 +
 
 +
 
 +
== Get the Unselected Objects ==
 +
{{versionSince| 7.0.1}}
 +
If users 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.
  
  
 
=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 70:
 
=Use cases=
 
=Use cases=
  
{| border='1px' | width="100%"
+
{| class='wikitable' | width="100%"
 
! Version !! Description !! Example Location
 
! Version !! Description !! Example Location
 
|-
 
|-
Line 43: Line 80:
 
=Version History=
 
=Version History=
  
{| border='1px' | width="100%"
+
{| class='wikitable' | width="100%"
 
! Version !! Date !! Content
 
! Version !! Date !! Content
 
|-
 
|-
| &nbsp;
+
| 7.0.0
| &nbsp;
+
| October, 2013.
| &nbsp;
+
| [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}}

Latest revision as of 08:36, 8 July 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 users want to know which of the selected items are newly added or removed, they can use the getPreviousSelectedItems method to filter out. (if a model exists and is in paging mold, it should return null)

Get the Previous Selected Objects

Since 7.0.1 If users 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.

Get the Unselected Items

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


Get the Unselected Objects

Since 7.0.1 If users 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.


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/07/08

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