【问题标题】:Primefaces tooltip for a datatable row数据表行的 Primefaces 工具提示
【发布时间】:2014-10-14 09:52:19
【问题描述】:

我需要在我的数据表的某些行上自动显示工具提示,没有任何事件,我已经阅读了它可以使用 Primefaces 扩展来完成,但找不到一个有效的示例。 我不知道 forSelector 属性应该取什么值。

<pe:tooltip value="Click to view More Datails"
forSelector="?" shared="true"
targetPosition="top center" position="left center"
autoShow="true" />

【问题讨论】:

    标签: primefaces tooltip primefaces-extensions


    【解决方案1】:

    设置自动显示属性为真

     <pe:tooltip value="AutoShow" autoShow="true"/>
    

    您可以将此属性绑定到 backingbean 值...

     <p:column id="ctipo3" headerText="Estado">                                                        
            <p:commandButton id="estado"/>
             <pe:tooltip id="toolTipTrack4" for="estado" value="#{item.texto}" autoShow="#{item.texto}"/>
     </p:column>
    

    【讨论】:

    • 谢谢,但我已经用autoShow="true" 进行了测试,但在我的情况下它不起作用(数据表行)。
    【解决方案2】:

    为了能够在数据表中显示一行的工具提示,这里有一个例子:

    <pe:tooltip forSelector=".myTable tr[role=row][data-ri=#{rowIndex}]" value="#{project['myfield.tooltip']} #{obj.myfield}"/>
    

    地点:

    • .myTable 是应用于数据表的 css 样式: styleClass="myTable"
    • rowIndex 是数据表中定义的行索引变量: rowIndexVar="rowIndex"

    此工具提示将添加到 &lt;p:column&gt; 中。

    请注意,为了能够使用 Primefaces Extensions 标签,您应该添加适当的 xmlns:

    xmlns:pe="http://primefaces.org/ui/extensions"
    

    【讨论】:

      猜你喜欢
      • 2012-04-16
      • 1970-01-01
      • 1970-01-01
      • 2018-02-17
      • 1970-01-01
      • 2023-03-21
      • 2014-07-05
      • 2016-02-11
      • 1970-01-01
      相关资源
      最近更新 更多