You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Yaron Spektor <ya...@b6systems.com> on 2008/05/20 23:53:26 UTC

displayValueOnly does not work in binded grid

Hi,

I narrowed down the problem; I can not make a selectOneMenu be
displayValueOnly in a grid when I bind the grid to the jsp page. Any
other  way it works fine (thanks Richard for directing my attention
towards the binding).

 

This is the jsp code some code snippets work and the last one does not:

If you use a regular t:selectOneMenu it works:

<t:selectOneMenu  displayValueOnly="true"
value="#{rootBean.displayUIBean.selectItems[2].value}" >

 <f:selectItems value="#{rootBean.displayUIBean.selectItems}"/>

</t:selectOneMenu>

 

If you bind it, it works too:

<t:selectOneMenu
binding="#{rootBean.displayUIBean.selectOneMenuComponentMyFaces}" />

 

In a tagged H:panelGrid it works

<h:panelGrid >


<t:selectOneMenu  displayValueOnly="true"
value="#{rootBean.displayUIBean.selectItems[2].value}" >

<f:selectItems value="#{rootBean.displayUIBean.selectItems}"/>

</t:selectOneMenu>


</h:panelGrid>

 

It DOES NOT work here:

<h:panelGrid
binding="#{rootBean.displayUIBean.panelGridComponentMyFaces}"/>

 

This is the bean code:

 

public UIComponent getSelectOneMenuComponentMyFaces() {

            HtmlSelectOneMenu selectOneMenuComponentMyFaces = new
HtmlSelectOneMenu();          

            ValueBinding binding =
FacesContext.getCurrentInstance().getApplication().createValueBinding("#
{rootBean.displayUIBean.selectItems[2].value}");


            selectOneMenuComponentMyFaces.setValueBinding("value",
binding);

            selectOneMenuComponentMyFaces.setDisplayValueOnly(true);

            UISelectItems items = new UISelectItems();

            items.setValue(getSelectItems());

            selectOneMenuComponentMyFaces.getChildren().add(items);


            //TRIED THIS TOO: binding =
FacesContext.getCurrentInstance().getApplication().createValueBinding("#
{rootBean.displayUIBean.trueValue}");                          

            //TRIED THIS TOO:
selectOneMenuComponentMyFaces.setValueBinding("displayValueOnly",
binding);

            return selectOneMenuComponentMyFaces;

      }

 

public UIComponent getPanelGridComponentMyFaces() {         

            panelGridComponentMyFaces = new HtmlPanelGrid();

 
panelGridComponentMyFaces.getChildren().add(getSelectOneMenuComponentMyF
aces());

            return panelGridComponentMyFaces;

      }

 

 

 

Is it a JIRA item or am I missing something?

 

Yaron