Primefaces datatable displaying data horizontally

Hi this is my first post and sorry for my poor english. I'm using PrimeFaces 5 and I want to display data into dataTable but my problem is: data are displaying vertically and I want to display it horizontally.

In my Bean, I have an ArrayList of SerieVO objects. Each SerieVO object has a name.

    String name1 = "Serie 1";
    String name2 = "Serie 2";
    String name3 = "Serie 3";

    listSerieVO.add( new SerieVO( name1 ) );
    listSerieVO.add( new SerieVO( name2 ) );
    listSerieVO.add( new SerieVO( name3 ) );

In my xhtml, I have a dataTable:

            <h:dataTable value="#{myBB.listSerieVO}" var="data">
                <h:column>
                    #{data.name}
                </h:column>
            </h:dataTable>

The result is:

Serie 1
Serie 2
Serie 3

But I want the following:

Serie 1 | Serie 2 | Serie 3

Any suggestions will be greatly appreciated. Thanks!

Upvotes: 1

Views: 1731

Answers (1)

I used ui:repeat with table tag (and tr and td) instead h:dataTable

            <table border="1">
            <tr>
            <ui:repeat value="#{myBB.listSerieVO}" var="data" >
                <td>
                    #{data.name}
                </td>
            </ui:repeat>
            </tr>
            </table>

It works for me. Thanks!

Upvotes: 2

Related Questions