Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

SelectOneListbox question.  RSS feed

 
Darrin Smith
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my app I have a few selectOneListbox instances. Depending on the selection in the first, the second one gets populated

For example, say listbox1 looks like this:

1
2
3
4

If the user clicks on 2, then the values associated with item two get placed into listbox2.

Now all that is working just fine, but there is a problem. Say that the user selects 2 in listbox1 and that adds items to listbox2 that look like this:

a
b
c
d

Now say the user selects item b in listbox2. Still OK, but when the user then goes back to listbox1 and selects a different item, say item 3, then when the items associated with item 3 get populated into listbox2, it shows item b has already having been selected!

So, in short, whatever the user selects in listbox2 for any item will be selected automatically when the user seelcts a different option in listbox1.

This is not what I want.

I have tried doing listboxDefaultItems.clear() on listbox2, but it still autoselects the item every time!

So, how can you unselect a selectOneListbox in this case?

Thanks!
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you show me the code to your backing bean, I have a project setup I use for testing and I can throw your code in and see what happens. I just don't feel like recreating all your code right now.
 
Darrin Smith
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gregg Bolinger:
If you show me the code to your backing bean, I have a project setup I use for testing and I can throw your code in and see what happens. I just don't feel like recreating all your code right now.


It's pretty big (whole thing is over 2000 lines...lots of white space and comments of course).

Maybe I could give you some parts of interest, but I walked through it (JSC IDE) in the debugger and I can say for certain that my code isn't setting the value.

In short, I checked every place that a listbox.setValue(someIndex) is done and none of them were being called. It's like the listbox remembers the index and resets itself to it each time.

Is there not a way to "deselect" the listbox maybe? I tried doing a listbox.setValue("") but that just seemed to specify the first entry in the box instead of unselecting anything.
[ September 28, 2005: Message edited by: Darrin Smith ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!