-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I have a listbox like this
<listbox id="results" height='97%' onSelect="runMethod(self);">
In runMethod i have some code like this
results.getModel().getElementAt(lb.getSelectedIndex()));
The problem is we are receiving sometimes the infamous
java.lang.ArrayIndexOutOfBoundsException: -1
I think the problem is here
lb.getSelectedIndex()
My question is.. is possible that Listbox onSelect
event is fired even if listbox has no selected index i mean lb.getSelectedIndex()
returns -1?
If so what circumstances would do so...
Any help is hugely appeciate best regards from Venezuela...
I think there was a bug fix for this but i cannot remember in which version it was applied. Maybe if you search the issue tracker?
Costas
Hello javiut,
I will recommend something a little different.
Please change your listbox by adding the selectedItem property.
This way you will have the selected item of the listbox, and you will also be able to add your functionality in your java code.
Please try it out, and let me know the results.
Best Regards,
Darksu
Asked: 2014-12-09 12:02:16 +0800
Seen: 19 times
Last updated: Dec 14 '14
Controller updating UI every minute
annotation porting from zk 3.6.2 to 6.5.3
How to customize "Processing..." message
JBoss AS 7.1 +Spring+ZK+DHtmlLayoutServlet
Portallayout, portalchildren ordering storage, possible bug
Sniffer Based Monitoring of ZK Apps
The server is temporarily out of service. (syntax error (SyntaxError))
can't you check if the selected index isn't -1 before you ask the element from the model?
chillworld ( 2014-12-09 15:00:51 +0800 )editYes.. but i need to reproduce it to be able to fixed because i work remote and i need to be able to solved it the issue reproduce it... is weird i know.
javiut ( 2014-12-09 15:05:27 +0800 )edit