PDA

View Full Version : possible to show tooltip only for a TextItem when its container also has tooltip?



aj3423
9 Jun 2010, 2:44 AM
the code is something like:


var textItem = new Ext.Toolbar.TextItem(..);
new Ext.ToolTip({
target: textItem.id,
html: 'Tooltip for TextItem'
});
var toolbar = new Ext.Toolbar({
items:[textItem] // textItem in toolbar
});

new Ext.ToolTip({
target: toolbar.id,
mouseOffset: [-18, -40],
html: 'Tooltip for Toolbar'
});

20879

aj3423
10 Jun 2010, 1:49 AM
Tooltip = Ext.extend(Ext.ToolTip, {
constructor: function(cfg) {
Ext.getCmp(cfg.target).tooltip = this;
this.targetCmp = Ext.getCmp(cfg.target);
Tooltip.superclass.constructor.call(this, cfg);
},
onTargetOver : function(e){
e.stopEvent();
this.disableContainerTooltip();
Tooltip.superclass.onTargetOver.call(this, e);
},
onTargetMove: function(e) {
e.stopEvent();
this.disableContainerTooltip();
Tooltip.superclass.onTargetMove.call(this, e);
},
disableContainerTooltip: function() {
var t = this.targetCmp;
var c = t.ownerCt;
var ct = c.tooltip;
if(ct) {
ct.clearTimers();
ct.hide();
}
}
});

i extended the Ext.Tooltip, and this seems works