PDA

View Full Version : ToolTip on items in TreePanel ( qtip )



Arno.Nyhm
26 Aug 2009, 1:46 AM
i searched the forum but i dont find a quick way to set a ToolTip (qtip / quicktip ) on a treeitem in treepanel.

the TreeItem.setToolTip are only supported in gxt 1.x

there are some nice solutions?

Arno.Nyhm
26 Aug 2009, 3:37 AM
i found a solution:



treePanel.setLabelProvider(new ModelStringProvider<MyTreeItem>() {

public String getStringValue(MyTreeItem model, String property) {
String myId = model.getMyId();
String name = model.getName();
return "<span qtip='" + name + "' qtitle='" + myId + "'>" + name +"<span>";
}
});or with XTemplate:



treePanel.setLabelProvider(new ModelStringProvider<MyTreeItem>() {

XTemplate template = XTemplate.create("<span qtip='<p><b>Name:</b> {name}</p><p><b>MyID:</b> {myid}</p>' qtitle='{myid}'>{name}<span>");

public String getStringValue(MyTreeItem model, String property) {
return template.applyTemplate(Util.getJsObject(model, 3));
}
});NOTE: dont forget to apply the quicktip to the treepanel!


new QuickTip(treePanel);