Rajath
Rajath

Reputation: 2188

Values displaying in a single column even if columns attribute is set to 2 in <h:panelGrid>

I'm using a to print in two strings in two columns as in the following code:

<h:panelGrid
            columns="2" border="1">
        <ui:repeat
            value="#{bean.selectedLocales}"
                    var="locale">
            <h:outputText value="#{msg[locale]}"/>
        </ui:repeat>
</h:panelGrid>

The above prints two locales en and de taken from a list in a same column although I use ui:repeat and columns="2" in <h:panelGrid>. How can I make it to print in two different columns?

Upvotes: 1

Views: 761

Answers (1)

Donato Szilagyi
Donato Szilagyi

Reputation: 4369

The reason is that your h:panelGrid contains only one nested element: ui:repeat, and it cannot show the one element in two columns. What about doing a dynamic dataTable of it using the vendor specific columns eg. p:columns, ice:columns in the JSF page and javax.faces.model.ListDataModel in the managed bean?

Upvotes: 1

Related Questions