I have a question
I am using Richfaces the suggestionbox with a listShuttle. Basically what I want to do is when a user selects/clicks on an item in the suggestionBox that this item is selected in my listShuttle (in the sourceValue list). (Let say I have 1000 values -String - in my listShuttle, then the suggestionBox is used to find quickly an item and focus on it in the listShuttle, it is more convenient than using the scroller of the listShuttle ).
I retrieve the good value but I do not know how to "focus" on the element in my list ... I am pretty sure is it simple but I tried, t.select(), t.focus() ... but nothing is working :/
Both the forums are not related at all, it's just that some people might be contributing to both the forums
and it might be a waste of their time looking at the same question!
In response to your question , have you looked at the activeItem attribute of listShuttle?
Hum, I can retrieve the active item in the shuttle list :
So, I looked in the API, and there is a setActiveItem, but I cannot make it work :/
I tried document.getElementById('chartSettingsForm:parametersListShuttle').component.sourceList.setActiveItem('myStringInTheShuttleList'), or .setActiveItem('chartSettingsForm:parametersListShuttle:3') but doesn't seem to work
It seems to be easy :/ There is no example with the activeItem attribute of the shuttle list , and I do not now how to use it to set an active item.
Ok I have a working example for your problem, list shuttle has a pretty nasty dom !
I have just changed the stylesheet class for the matched row using javscript.
Richfaces defines several style classes that you can use with a list shuttle component(class names can be found in the userguide).
I tried using the activeItem attribute by using a value expression and then using ajax to set the activeItem, but I was facing some issues.
But this should be a simple workaround.
The first one is by using the class to highlight the element found in the suggestion box , itdoes not scroll to the position of the element (I have more than 200 elements in my list), but when I scroll to my element, it is highlighted
The second issue is after the highlight of an element, if I select an other element, then the previous found element stays highlighted
I tried it now, and I found another issue different from your issues ! I did not try the scrolling so I can't test that.
However, it does clear the old highlighted element (else in the code takes care of that)
The problem that I found was , it only 'highlights' the element, it does not 'select' it, so the user still has to 'select' it.
I went through the source code for list-shuttle, but have not found time to try anything yet.