9 Replies Latest reply on Sep 26, 2007 8:25 AM by sressi

    tooltip with DataTable

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


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



        • 1. Re: tooltip with DataTable

          do you have a h:form around ?

          • 2. Re: tooltip with DataTable

            Yes, there's an h:form around.

            • 3. Re: tooltip with DataTable

              do you have <rich:messages /> somewhere on this page?

              • 4. Re: tooltip with DataTable

                No rich:messages on this page.

                • 5. Re: tooltip with DataTable

                  put it, at least for the testing purpose.

                  • 6. Re: tooltip with DataTable

                    No messages on the rich:messages tag.

                    • 7. Re: tooltip with DataTable
                      tromanowski

                      I am having the same problem, albeit with my own code. Using Firefox and Firebug, I am not seeing any errors. I've tried using the tooltip without specifying any arguments, as well as setting a number of attributes as in the official demo (which I also use in the snippet below). Nothing I've done has led to a working tooltip.


                      <rich:column>
                       <g:columnHeader headerText="#{msg.path}" sortField="path" />
                       <h:outputText value="#{item.path}" >
                       <rich:toolTip direction="top-right" verticalOffset="5" zorder="200" styleClass="tooltip" layout="block">
                       <f:facet name="defaultContent"><h:outputText value="Waiting..."/></f:facet>
                       <h:outputText value="Testing..."/>
                       </rich:toolTip>
                       </h:outputText>
                       </rich:column>
                      



                      Here is the output:

                      <td class="dr-table-cell rich-table-cell text">
                      <div id="j_id118:items:4:j_id152" class="dr-rich-tool-tip rich-tool-tip tooltip" style="position: absolute; display: none; z-index: 200; visibility: visible;">
                      <div id="j_id118:items:4:j_id152content">Testing...</div>
                      <span id="j_id118:items:4:j_id152script" style="display: none;">
                      <script id="scriptj_id118:items:4:j_id152" type="text/javascript">
                      1
                      2new ToolTip({'delay':0,'oncomplete':'','onshow':'','onhide':'','event':'mouseover'} ,"j_id118:items:4:j_id152","j_id118:items:4:j_id151","client",false,"top-right",false,10,5,"A4J.AJAX.Submit('_viewRoot','j_id118',event,ajaxOptions)",{'parameters':{'j_id118:items:4:j_id152':'j_id118:items:4:j_id152'} ,'actionUrl':'/TestProject/faces/test/Test_List.xhtml','oncomplete':function(request,event,data){;Richfaces.tooltips['j_id118:items:4:j_id151'].toolTip = $('j_id118:items:4:j_id152');;Richfaces.tooltips['j_id118:items:4:j_id151'].toolTipContent = $('j_id118:items:4:j_id152content');;Richfaces.tooltips['j_id118:items:4:j_id151'].displayDiv();},'control':this,'onbeforedomupdate':function(request,event,data){;Richfaces.tooltips['j_id118:items:4:j_id151'].toolTip.style.display = 'none';}} );;
                      3
                      4
                      </script>
                      </span>
                      </div>
                      \\tesla\test\myPath.txt
                      </td>
                      


                      • 8. Re: tooltip with DataTable
                        ilya_shaikovsky

                        Sorry for the delay guys. The developer guide already declared the limitation:

                        It's nesessary to set the id for parent element So jsut set the id to your output Text and all should renders fine.

                        • 9. Re: tooltip with DataTable

                          Thanks!!!!