How to show tooltip for the header of dynamic Table p:dataTable when the mouse over the header to display the entire title of header column.
<p:dataTable id="detailDataTable" widgetVar="detailWidgetVar"
value="#{model.elements}" var="element"
paginator="false" resizableColumns="false" scrollWidth="100%"
scrollable= "true" emptyMessage="Aucun résultat"
styleClass="tableResultat" rowStyleClass="">
<p:columns value="#{model.columns}" var="column" columnIndexVar="colIndex"
headerText="#{column.header}"
styleClass="#{column.styleClass}" width="#{column.width}"
sortBy="#{(element[column.productId])[column.property]}">
<h:outputText value="#{(element[column.productId])[column.property]}"
title="#{(element[column.productId])[column.property]}"/>
</p:columns>
</p:dataTable>
You could use the Global Primefaces Tooltip; You just need to change your approach to setting the header text, using the <f:facet/>
rather than the headerText
attribute. Using your code sample
<p:tooltip/>
<p:columns value="#{model.columns}" var="column" columnIndexVar="colIndex"
headerText= styleClass="#{column.styleClass}" width="#column.width}" sortBy="#{(element[column.productId])[column.property]}">
<f:facet name="header">
<h:outputText value="#{column.header}" title="#{column.header}"/>
</f:facet>
<h:outputText value="#{(element[column.productId])[column.property]}" title="#{(element[column.productId])[column.property]}"/>
</p:columns>
Two things have happened
<p:tooltip/>
title
attribute on the header facet text. This is what hooks into the global tooltip, to display tooltip text per columnIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With