【问题标题】:Primefaces datatable displaying data horizontallyPrimefaces 数据表水平显示数据
【发布时间】:2014-12-09 21:02:27
【问题描述】:

嗨,这是我的第一篇文章,很抱歉我的英语不好。我正在使用 PrimeFaces 5,我想将数据显示到 dataTable 中,但我的问题是:数据是垂直显示的,我想水平显示它。

在我的 Bean 中,我有一个 SerieVO 对象的 ArrayList。每个 SerieVO 对象都有一个名称。

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

在我的 xhtml 中,我有一个数据表:

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

结果是:

意甲
意甲 2
意甲 3

但我想要以下内容:

意甲 1 |意甲 2 |意甲 3

任何建议将不胜感激。谢谢!

【问题讨论】:

    标签: primefaces datatable


    【解决方案1】:

    我使用 ui:repeat 和 table 标签(以及 tr 和 td)而不是 h:dataTable

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

    它对我有用。谢谢!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-22
      • 2021-01-07
      • 1970-01-01
      • 1970-01-01
      • 2015-12-23
      • 1970-01-01
      • 2012-06-12
      • 1970-01-01
      相关资源
      最近更新 更多