PDA

View Full Version : How to customize the style of qtip on the TreeNodes in a TreePanel



sweetstian
22 Feb 2012, 5:43 AM
Hello,

I use the qtip attribute in the html of TreeNode in order to get different tooltips for each TreeNode in a TreePanel. I would like to make some change of the tooltip style, e.g. make it stay so that the mouse can go over it, but however I configure the ToolTipConfig of the TreePanel (on which the QuickTip is added), it cannot change the QuickTip of TreeNodes. If the ToolTipConfig is set directly to the TreePanel, it configures only another tooltip of the TreePanel, but not the floating qtip I see on each TreeNode.

Is there any solution to make a qtip which could stay for a delay or closable qtip on each TreeNode of a TreePanel?

Here is my code:

QuickTip quickTip = new QuickTip(treePanel);
ToolTipConfig toolTipConfig = new ToolTipConfig();
toolTipConfig.setDismissDelay(0); //disable automatic hiding
toolTipConfig.setHideDelay(800);
toolTipConfig.setAnchor("top");
toolTipConfig.setCloseable(true);
quickTip.setToolTip(toolTipConfig);
treePanel.setLabelProvider(new ModelStringProvider<OCODModel>() {
@Override
public String getStringValue(OCODModel model, String property) {
if (model.getTip() == null || model.getTip().equals(""))
return model.getHtml();
else
return "<span qtip='" + model.getTip() + "'>" + model.getHtml() + "</span>";
}

});

Ersmarker
27 Feb 2012, 6:24 AM
Change
quickTip.setToolTip(toolTipConfig);
to
quickTip.update(toolTipConfig)

With setTooltip you are creating a new tooltip on your QuickTip component.

sweetstian
1 Mar 2012, 9:20 AM
Yes, it works! That is what I was looking for.
Thanks a lot, Ersmarker!

ozlemsimsek
10 Oct 2012, 5:15 AM
How can I do this (have tooltip for each node of tree item) if I am using a newer version of GXT. I am using GXT 3.0.1 and instead of treePanel, in this version tree class is used and it does not have a setLabelProvider method.I can use QuickTip, but how can I set qtip attribute of treenodes?ThanksOzlem

kozla13
10 Dec 2013, 6:35 AM
i am also trying with version 3.06