3

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

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Alanzi
  • 272
  • 3
  • 10

2 Answers2

0

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.

spauny
  • 4,976
  • 9
  • 44
  • 61
  • I appreciate the suggestion, but I pretty much already do that. These p:inplace and h:selectOneMenu tags are inside of cells in a table, and when columns are dynamically created, the selectOneMenus are given default values. (That's also the reason I use selectOneMenus instead of selectOneListboxes--the table cells would greatly expand the row when the p:inplace is triggered.) – Alanzi Dec 20 '11 at 17:34
0

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!

Community
  • 1
  • 1
Alanzi
  • 272
  • 3
  • 10