0

I faced a problem with primefaces and tooltip on a single cell column.I was not able to use it so I searched the web and I found many answer like this one. the first answer did not solved the problem, infact that did nothing at all and the second one gave me error at runtime, telling me that it cannot find the righ object in the page.

So,how can i use a tooltip on a single cell of a table for each row? I'm using primefaces 5.1, jsf 2.2, java 1.6.

Community
  • 1
  • 1
BohBah
  • 109
  • 1
  • 3
  • 11

3 Answers3

0

despite many answers that suggest you to use primefaces extensions, the only thing you have to do to see your tooltip is to use primefaces itself like this:

<p:tooltip id="toolTipGrow" value="#{row.property}" shared="true" for="idField" showEffect="clip" position="top"/>

where idField is the id from which you want to see the tooltip appear and row.property is the value that you want to show into it.

the thing is now simple to make. here it is an example with the datatable:

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

I hope this will help.

Best Regards

BohBah
  • 109
  • 1
  • 3
  • 11
0

Yes its possible. See..

<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>
SimonA
  • 9
  • 1
  • 6
0

In my scenario, I have all my data in cells inside h:outputText elements. In that case, you can then use the title attribute.

<p:column>
    <h:outputText value="#{row.data}" title="#{row.data}"/>
</p:column>