Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-13830

Tooltip not attached must specify target=""

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.5.0.Beta1
    • Fix Version/s: 4.5.0.CR1
    • Component/s: None
    • Labels:
      None
    • Sprint:
      4.5.0.CR1 - Sprint 2

      Description

      Hi,

      I use a generic tooltip that I refresh before open it. It is not attached cause it can be open by many action.

      Without the attributes target (empty), it's like the tooltip is attached to the body. ShowEvent by default is mouseenter. So, the tooltip open when I move the mouse on the screen.

      The way I think it should be :
      I think when the tooltip is not attached, we don't need to specify the target has empty. And, the default showEvent can't be mouseenter cause it is not attached. :/

      This is my test case :

      TooltipBean.java

      /**
       * @author Jonathan Laterreur
       * 
       */
      @ViewScoped
      @ManagedBean
      public class TooltipBean implements java.io.Serializable {
      	private static final long serialVersionUID = -5076157934440396198L;
       
      	private List<String> lst = new ArrayList<String>();
       
      	private String text;
       
      	public List<String> getLst() {
      		return lst;
      	}
       
      	public void setLst(List<String> lst) {
      		this.lst = lst;
      	}
       
      	public String getText() {
      		return text;
      	}
       
      	public void setText(String text) {
      		this.text = text;
      	}
       
      	@PostConstruct
      	public void init() {
      		for (int i = 0; i < 10; i++)
      			lst.add("Ligne " + i);
      	}
       
      	public void afficherTooltipListener(ActionEvent event) {
      		if (text == null)
      			text = "kajhsdfkljahs dflkahsd flkjahsdfkljhasdkljhfaklsjdh fakjlsdh fk"
      					+ "ljashd fkjahs dkljf hasdklj fhalksdh falkjsdh flkajseh fkljasdh flkjahs dflk";
      		else
      			text = "kajhsdfkljahs dflkahsd flkjahsdfkljhasdkljhfaklsjdh fakjlsdh fkljashd fkjahs dkljf hasdklj "
      					+ "fhalksdh falkjsdh flkajseh fkljasdh flkjahs dflkkajhsdfkljahs dflkahsd flkjahsdfkljhasdkl"
      					+ "jhfaklsjdh fakjlsdh fkljashd fkjahs dkljf hasdklj fhalksdh falkjsdh flkajseh fkljasdh f"
      					+ "lkjahs dflkkajhsdfkljahs dflkahsd flkjahsdfkljhasdkljhfaklsjdh fakjlsdh fkljashd fkjahs "
      					+ "dkljf hasdklj fhalksdh falkjsdh flkajseh fkljasdh flkjahs dflkkajhsdfkljahs dflkahsd flk"
      					+ "jahsdfkljhasdkljhfaklsjdh fakjlsdh fkljashd fkjahs dkljf hasdklj fhalksdh falkjsdh flkaj"
      					+ "seh fkljasdh flkjahs dflkkajhsdfkljahs dflkahsd flkjahsdfkljhasdkljhfaklsjdh fakjlsdh fkljashd fkjahs dkl"
      					+ "jf hasdklj fhalksdh falkjsdh flkajseh fkljasdh flkjahs dflkkajhsdfkljahs dflkahsd flkjahsdfkljhasdkljhfak"
      					+ "lsjdh fakjlsdh fkljashd fkjahs dkljf hasdklj fhalksdh falkjsdh flkajseh fkljasdh flkjahs dflk";
      	}
      }
      

      Tooltip.js

      var realEvent;
       
      function keepEvent(event){
      	realEvent = event;
      }
       
      function resetEvent(){
      	realEvent = null;
      }
       
      function showTooltip($tooltip){
      	$tooltip.show(realEvent);
      	realEvent = null;
      }
      

      tooltip.xhtml

      <h:form>
      				<h:outputScript name="javascript/Tooltip.js" />
       
      				<rich:dataTable value="#{tooltipBean.lst}" var="i">
      					<rich:column>
      						<h:outputText value="#{i}" />
      					</rich:column>
      					<rich:column>
      						<h:commandButton value="#{i}"
      							actionListener="#{tooltipBean.afficherTooltipListener}"
      							onclick="keepEvent(event);">
      							<a4j:ajax render="tooltip"
      								oncomplete="showTooltip(#{rich:component('tooltip')});"
      								onerror="resetEvent();" />
      						</h:commandButton>
      					</rich:column>
      				</rich:dataTable>
       
      				<rich:tooltip id="tooltip" mode="ajax" layout="block"
      					attached="false" followMouse="false" 
      					onclick="#{rich:component('tooltip')}.hide(event)">
      					<h:outputText value="#{tooltipBean.text}" />
      				</rich:tooltip>
      			</h:form>
      

      There is a workaround, I need to add this attribute target="". And it is really strange that I need to specify the show event to click when it is not attached.

      Thank you!

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                michpetrov Michal Petrov
                Reporter:
                jonleyo Jonathan Laterreur
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 45 minutes
                  45m
                  Remaining:
                  Remaining Estimate - 45 minutes
                  45m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified