【问题标题】:Primefaces datatable scrolling not working as hopedPrimefaces 数据表滚动无法按预期工作
【发布时间】:2013-11-27 08:49:27
【问题描述】:

我已经按照 primefaces 展示示例来制作可滚动的数据表,虽然它可以跨越它,但它使所有列都非常小,我无法真正阅读这些列,可滚动功能的原因是我需要显示大量的列,有什么方法可以保持列的大小,同时使数据表可滚动?

这是数据表代码:

<p:dataTable id="UserTable"
   widgetVar="usersTable" 
   paginator="true" rows="10"
   value="#{usertableController.items}"
   var="item"
   emptyMessage="No details was found with given criteria"
   scrollable="true" scrollWidth="400">

我总共需要显示 14 列

谢谢大家

【问题讨论】:

    标签: jsf jsf-2 primefaces


    【解决方案1】:

    您可以随时将width= "X" 发送给您的&lt;p:column&gt;&lt;p:columns&gt;。它在数据表可滚动时起作用。如下,

    <p:column selectionMode="multiple" width="15" />
    
    <p:columns width="150" value="..." var="..." columnIndexVar="..." sortBy="..." filterBy="..." >
    

    【讨论】:

    • 您好,谢谢,但是当我尝试实现时,我得到javax.faces.FacesException: DataModel must implement org.primefaces.model.SelectableDataModel when selection is enabled.
    • 你想使用选择吗?如果没有,请不要使用“selectionMode”。如果这样做,您是否尝试在数据表中添加“rowKey”?你可能想检查一下:stackoverflow.com/questions/12333764/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-05
    相关资源
    最近更新 更多