9 Replies Latest reply on Sep 26, 2007 8:25 AM by Sebastián Ressi

    tooltip with DataTable

    Sebastián Ressi Newbie

      I've tryed to reproduce the demo example, using tooltip with a DataTable, but it ain't working. The tooltip is not shown, I just can't figure out why.
      Here's my code:
      ....................................................................

      <rich:datascroller id="scrollersrc" for="src" maxPages="5" style="panelbody"/>
       <rich:dataTable id="src" value="#{toolTipData.empleados}" var="emp" rows="15" rowKeyVar="row">
       <rich:column>
       <f:facet name="header">
       <h:outputText value="##" />
       </f:facet>
       <h:outputText value="#{row+1}" />
       </rich:column>
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Empleado" />
       </f:facet>
       <h:outputText value="#{emp.apellido}, #{emp.nombre}" styleClass="row">
       <rich:toolTip direction="top-right" mode="ajax" verticalOffset="5" zorder="200" styleClass="tooltip" layout="block" event="onclick">
       <a4j:actionparam name="key" value="#{row}" assignTo="#{toolTipData.currentempleadoindex}" />
       <f:facet name="defaultContent">
       <h:outputText value="Esperando..." styleClass="Texto"></h:outputText>
       </f:facet>
       <h:panelGrid columns="2">
       <h:outputText value="Documento:" />
       <h:outputText value="3.310.962-9" styleClass="Texto" />
       </h:panelGrid>
       </rich:toolTip>
       </h:outputText>
       </rich:column>
       </rich:dataTable>

      .......................................................................

      public class ToolTipData {
       private int tooltipCounter = 0;
       private List empleados = null;
       private int currentempleadoindex = -1;
      
       public int getCurrentempleadoindex() {
       return currentempleadoindex;
       }
      
       public void setCurrentempleadoindex(int currentempleadoindex) {
       this.currentempleadoindex = currentempleadoindex;
       }
      
       public List getEmpleados() {
       System.out.println("Estoy en getEmpleados()");
       if (empleados == null){
       empleados = (List)((Presentacion)FacesUtils.getManagedBean("presentacion")).getEmpleados();
       return empleados;
       }
       else {
       return empleados;
       }
       }
      
       public void setEmpleados(List empleados) {
       this.empleados = empleados;
       }
      
       public int getTooltipCounter() {
       try {
       Thread.sleep(1000);
       } catch (InterruptedException e) {
       }
       return tooltipCounter++;
       }
      
       public void setTooltipCounter(int tooltipCounter) {
       this.tooltipCounter = tooltipCounter;
       }
      
       public Date getTooltipDate() {
       return new Date();
       }
      
       public Empleado getCurrentEmpleado() {
       System.out.println("Estoy en getCurrentEmpleado()");
       if (currentempleadoindex > 0 && currentempleadoindex < getEmpleados().size()){
       return (Empleado)getEmpleados().get(currentempleadoindex);
       }
       else{
       return null;
       }
       }
      }


      .......................................................................