• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Question listshuttle + suggestionBox

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone

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 ).

What I am doing right know, is using a javascript function on the onselect="selectItem();" event of the suggestionBox, so I have :



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 :/

Thanks for your help
 
jules poit
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nobody ?
 
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please post only on one forum on one site unless you don't receive a response for several days together.
Duplicate post : http://www.jboss.org/index.html?module=bb&op=viewtopic&t=162200

Also be patient while others get a chance to answer your question
 
jules poit
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ho, sorry about that,
I did not know both of these forums where related
 
Kavita Tipnis
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?


 
jules poit
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hum, I can retrieve the active item in the shuttle list :
document.getElementById('chartSettingsForm:parametersListShuttle').component.sourceList.activeItem

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.
 
Kavita Tipnis
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).

index.jsp


javascript


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.

 
jules poit
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the help

Two "issues" with your code,

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
 
Kavita Tipnis
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jules,
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic