Fill a ace:comboBox value from controller bean

133 views Asked by At

I want to auto-complete the value of my ace:comboBox when it has only one selectItem.

This is my JSF combo:

<ace:comboBox id="target" value="#{controller.filters.target}" 
            styleClass="combo-read-only" rendered="#{true}">

        <f:selectItems value="#{controller.targets}" />

</ace:comboBox>

So in my controller I have:

@PostConstruct
@Override
protected void init() {
       /* code in which I populate my targets list */
       if(targets.size() == 1) {
              String target = targets.get(0);
              getFilters().setTarget(target);
       }

targets is a list of javax.faces.model.SelectItem.

But when I load my JSF, the comboBox does not contain the auto-complete value, but in the selectedItems there's only one item.

I am not understanding what is wrong in my code.

0

There are 0 answers