-
FEATURED COMPONENTS
First time here? Check out the FAQ!
1 | initial version | |
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)
2 | No.2 Revision |
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)
3 | No.3 Revision |
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)
4 | No.4 Revision |
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