Primefaces 5.1 在数据表的单个单元格上为没有扩展名的每一行显示工具提示
Primefaces 5.1 show tooltip on single cell of a datatable for each row without extensions
我在单个单元格上遇到了 primefaces 和工具提示的问题 column.I 无法使用它,所以我在网上搜索并找到了很多答案 like this one。第一个答案没有解决问题,实际上什么也没做,第二个在运行时给了我错误,告诉我它无法在页面中找到正确的对象。
那么,如何在 table 的每一行的单个单元格上使用工具提示?
我正在使用 primefaces 5.1、jsf 2.2、java 1.6.
尽管许多答案建议您使用 primefaces 扩展,但要查看工具提示,您唯一需要做的就是像这样使用 primefaces 本身:
<p:tooltip id="toolTipGrow" value="#{row.property}" shared="true" for="idField" showEffect="clip" position="top"/>
其中 idField 是您希望从中看到工具提示的 ID,row.property 是您要显示的值想秀进去。
这东西现在很容易制作。这是数据表的示例:
<p:dataTable var="row" value="#{....}" styleClass="myTable">
<p:column headerText="Header 2">
<h:outputText value="#{row.value2}" id="idField" />
<p:tooltip id="toolTipGrow" value="#{row.property}" shared="true" for="idField" showEffect="clip" position="top"/>
</p:column>
</p:dataTable>
希望对您有所帮助。
此致
是的,这是可能的。见..
<p:column>
<f:facet name="header">
<h:outputText
id="header"
value="Header"
/>
<p:tooltip
for="header"
showEffect="fade"
hideEffect="fade"
>
<!-- content of tooltip for header -->
</p:tooltip>
</f:facet>
<h:outputText
id="col"
value="#{object.valueA}"
/>
<p:tooltip
for="col"
showEffect="fade"
hideEffect="fade"
>
<!-- content of tooltip for cell -->
</p:tooltip>
</p:column>
在我的场景中,我的所有数据都在 h:outputText 元素内的单元格中。
在这种情况下,您可以使用标题属性。
<p:column>
<h:outputText value="#{row.data}" title="#{row.data}"/>
</p:column>
我在单个单元格上遇到了 primefaces 和工具提示的问题 column.I 无法使用它,所以我在网上搜索并找到了很多答案 like this one。第一个答案没有解决问题,实际上什么也没做,第二个在运行时给了我错误,告诉我它无法在页面中找到正确的对象。
那么,如何在 table 的每一行的单个单元格上使用工具提示? 我正在使用 primefaces 5.1、jsf 2.2、java 1.6.
尽管许多答案建议您使用 primefaces 扩展,但要查看工具提示,您唯一需要做的就是像这样使用 primefaces 本身:
<p:tooltip id="toolTipGrow" value="#{row.property}" shared="true" for="idField" showEffect="clip" position="top"/>
其中 idField 是您希望从中看到工具提示的 ID,row.property 是您要显示的值想秀进去。
这东西现在很容易制作。这是数据表的示例:
<p:dataTable var="row" value="#{....}" styleClass="myTable">
<p:column headerText="Header 2">
<h:outputText value="#{row.value2}" id="idField" />
<p:tooltip id="toolTipGrow" value="#{row.property}" shared="true" for="idField" showEffect="clip" position="top"/>
</p:column>
</p:dataTable>
希望对您有所帮助。
此致
是的,这是可能的。见..
<p:column>
<f:facet name="header">
<h:outputText
id="header"
value="Header"
/>
<p:tooltip
for="header"
showEffect="fade"
hideEffect="fade"
>
<!-- content of tooltip for header -->
</p:tooltip>
</f:facet>
<h:outputText
id="col"
value="#{object.valueA}"
/>
<p:tooltip
for="col"
showEffect="fade"
hideEffect="fade"
>
<!-- content of tooltip for cell -->
</p:tooltip>
</p:column>
在我的场景中,我的所有数据都在 h:outputText 元素内的单元格中。 在这种情况下,您可以使用标题属性。
<p:column>
<h:outputText value="#{row.data}" title="#{row.data}"/>
</p:column>