Question

I'm using Primefaces p:inplace such that when some text is clicked, it's replaced with an h:selectOneMenu, and from there the user can open the menu and select an option from the drop-down choices. It would be helpful (and alleviate an extra click) if when I clicked the p:inplace element, the selectOneMenu that appeared was already activated with its drop-down options showing, as if the user had clicked it. I've searched for this on Google to no avail, and was wondering if perhaps it is actually possible to do such a thing, even with JavaScript. (I can also use p:selectOneMenu or a selectOneListbox if need be, but it didn't seem like that would help.)

Was it helpful?

Solution 2

I found this similar Stack Overflow question today (don't know how I missed it originally):

Can I open a dropdownlist using jQuery

Looks like our fears are right and there's no way to open the drop-down list itself, but a combination of CSS and modifying the element may give me the results I'm looking for. Thanks!

OTHER TIPS

As you say, you could use a selectOneListBox, especially if you have few options(works just fine inside p:inplace). I've never heard of a request like that and I think it's all about the browser (there may be some restrictions regarding an auto-expand).

But you can do a thing that could please you: remove the default option, like:

<f:selectItem itemLabel="Select..." itemValue=""/>

and do some research to find out the most selected option and put that option as a default/first. So most of the people will not even have to expand the select menu.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top