Revision history [back]

click to hide/show revision 1
initial version

answered 2016-04-26 01:30:42 +0800

cor3000 gravatar image cor3000

Hi Mathieu,

the command is called after the event has already successfully updated the selection. So that's not a way to prevent selection.

To enable this you'd need a custom event (s.th. like onBeforeSelection) that fires before the real onSelect is executed (requires a custom Listbox component).

Apart from that the SelectionEvent contains the previousSelection so you can also revert it: https://www.zkoss.org/javadoc/8.0.0/zk/org/zkoss/zk/ui/event/SelectEvent.html#getPreviousSelectedObjects()

@ContextParam(ContextType.TRIGGER_EVENT) SelectEvent selectEvent

A third option is to make the items non selectable in the listbox while rendering this will prevent this situation in the first place. https://www.zkoss.org/javadoc/7.0.3/zk/org/zkoss/zul/Listitem.html#setCheckable(boolean) or https://www.zkoss.org/javadoc/7.0.3/zk/org/zkoss/zul/Listitem.html#setDisabled(boolean)

Hi Mathieu,

the command is called after the event has already successfully updated the selection. So that's not a way to prevent selection.

To enable this you'd need a custom event (s.th. like onBeforeSelection) that fires before the real onSelect is executed (requires a custom Listbox component).

Apart from that the SelectionEvent contains the previousSelection so you can also revert it: https://www.zkoss.org/javadoc/8.0.0/zk/org/zkoss/zk/ui/event/SelectEvent.html#getPreviousSelectedObjectshttps://www.zkoss.org/javadoc/8.0.0/zk/org/zkoss/zk/ui/event/SelectEvent.html#getPreviousSelectedObjects%28%29()

@ContextParam(ContextType.TRIGGER_EVENT) SelectEvent selectEvent

A third option is to make the items non selectable in the listbox while rendering this will prevent this situation in the first place. https://www.zkoss.org/javadoc/7.0.3/zk/org/zkoss/zul/Listitem.html#setCheckable(boolean) or https://www.zkoss.org/javadoc/7.0.3/zk/org/zkoss/zul/Listitem.html#setDisabled(boolean)

Hi Mathieu,

the command is called after the event has already successfully updated the selection. So that's not a way to prevent selection.

To enable this you'd need a custom event (s.th. like onBeforeSelection) that fires before the real onSelect is executed (requires a custom Listbox component).

Apart from that the SelectionEvent contains the previousSelection so you can also revert it: https://www.zkoss.org/javadoc/8.0.0/zk/org/zkoss/zk/ui/event/SelectEvent.html#getPreviousSelectedObjects%28%29

@ContextParam(ContextType.TRIGGER_EVENT) SelectEvent selectEvent

A third option is to make the items non selectable in the listbox while rendering this will prevent this situation in the first place. https://www.zkoss.org/javadoc/7.0.3/zk/org/zkoss/zul/Listitem.html#setCheckablehttps://www.zkoss.org/javadoc/latest/zk/org/zkoss/zul/Listitem.html#setSelectable%28boolean%29(boolean) or https://www.zkoss.org/javadoc/7.0.3/zk/org/zkoss/zul/Listitem.html#setDisabled(boolean)

Hi Mathieu,

the command is called after the event has already successfully updated the selection. So that's not a way to prevent selection.

To enable this you'd need a custom event (s.th. like onBeforeSelection) that fires before the real onSelect is executed (requires a custom Listbox component).

Apart from that the SelectionEvent contains the previousSelection so you can also revert it: https://www.zkoss.org/javadoc/8.0.0/zk/org/zkoss/zk/ui/event/SelectEvent.html#getPreviousSelectedObjects%28%29

@ContextParam(ContextType.TRIGGER_EVENT) SelectEvent selectEvent

A third option is to make the items non selectable in the listbox while rendering this rendering. This will prevent this situation in the first place. https://www.zkoss.org/javadoc/latest/zk/org/zkoss/zul/Listitem.html#setSelectable%28boolean%29

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More