-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hey, since the upgrade to 5.0.7 I have a very weird behavior for the listbox component.
Let's say, I have a listbox with 5 rows, like this:
Row 1
Row 2
Row 3
Row 4
Row 5
Now, I click Row 2 and it gets highlighted:
Row 1
Row 2
Row 3
Row 4
Row 5
Now, I hold shift and click on row 4. I would now expect row 2-4 to be highlighted, but instead this happens:
Row 1
Row 2
Row 3
Row 4
Row 5
What's going on here?
I am on Mac OS X Snow Leopard with Google Chrome 12.
Same issue with Firefox on Mac and Chrome on Windows.
Hi,
I've just tried this demo with Google Chrome and Firefox (both on Linux) and it works fine for me:
http://www.zkoss.org/zkdemo/listbox/multiple_selection
Can you reproduce the issue with the demo?
Cheers, Maik
I think I found the cause of the problem but I can't nail it down.
I registered the ON_CLICK event for all listitems like this:
listitem.addEventListener(Events.ON_CLICK, new MessageHeaderSelectedEventListener() { @Override public void onEvent(Event event) throws Exception { if (event instanceof MouseEvent) { MouseEvent mouseEvent = (MouseEvent) event; // Don't open the message if shift, ctrl or right mouse button was used int pressedKey = mouseEvent.getKeys(); if (ignoreKeysPressed(pressedKey)) { return; } // Get the message behind the event CachedMessage message = eventToMessage(mouseEvent); // Get the listitem which got clicked Component target = mouseEvent.getTarget(); Listitem item = null; if (target instanceof Listitem) { item = (Listitem) target; } // Display the message handleMessageSelect(message, item, mailheadlistbox_div_root.getParent()); } } });
I first thought that I accidently overwrote the default behavior but if that would be the case, multiple selection wouldn't work at all, wouldn't it? But instead it's just not working properly.
Also, I have a very similar problem with the ON_OK event.
I want a specific function to be called when the user selects a listbox item with the UP and DOWN arrow keys and then presses ENTER.
So, I added the event like this:
listitem.addEventListener(Events.ON_OK, new MessageHeaderSelectedEventListener() { @Override public void onEvent(Event event) throws Exception { if (event instanceof KeyEvent) { KeyEvent keyEvent = (KeyEvent) event; // Get the message behind the event CachedMessage message = eventToMessage(keyEvent); // Get the listitem which got clicked Component target = keyEvent.getTarget(); Listitem item = null; if (target instanceof Listitem) { item = (Listitem) target; } // Set the message handleMessageSelect(message, item, mailheadlistbox_div_root.getParent()); } } });
The strange thing is: Now the UP and DOWN keys don't work any more.
If I remove all custom event listeners, then everything works alright...
Asked: 2011-06-27 12:54:27 +0800
Seen: 104 times
Last updated: Jun 27 '11