PDA

View Full Version : Tooltips on Combobox/Triggerfields



wm003
16 Apr 2008, 1:35 AM
If you want to have Tooltips on the triggerbuttons of Triggerfields (Combobox,Datefield,...)
i have created a little plugin that makes it possible:



Ext.namespace('Ext.ux.plugin');

Ext.ux.plugin.triggerfieldTooltip = function(config){
Ext.apply(this, config);
};

Ext.extend(Ext.ux.plugin.triggerfieldTooltip, Ext.util.Observable,{
init: function(component){
this.component = component;
this.component.on('render', this.onRender, this);
},

//private
onRender: function(){
if(this.component.tooltip){
if(typeof this.component.tooltip == 'object'){
Ext.QuickTips.register(Ext.apply({
target: this.component.trigger
}, this.component.tooltip));
} else {
this.component.trigger.dom[this.component.tooltipType] = this.component.tooltip;
}
}
}
});


Just add



plugins:new Ext.ux.plugin.triggerfieldTooltip(),
tooltip: {
title:'This is the Triggerbutton',
text: 'If you click here, something happens with the formfield...'
},



to your existing Comboboxes and you have a tooltip/quicktip functionality.
Remember it only fires when hovering over the triggerButton, not the Field itself as this supports tooltips for validation messages (and this is ofcourse still possible)

chalu
17 Apr 2008, 5:05 AM
Please take a look at this thread : ,
XHR Combo Loading Indicator ?? (http://extjs.com/forum/showthread.php?t=32060&highlight=Combo+loading+indicator).

mystix
17 Apr 2008, 7:57 AM
Please take a look at this thread : ,
XHR Combo Loading Indicator ?? (http://extjs.com/forum/showthread.php?t=32060&highlight=Combo+loading+indicator).

i believe you've just hijacked this thread.
what's that thread got to do with this plugin? /:)

Michou
20 Apr 2008, 8:28 AM
Another way, add this code in your TriggerField config :


id: 'myTriggerField',
listeners: {
render: function(c){
Ext.get(this.id).set({qtitle:'your title'});
Ext.get(this.id).set({qtip:'your tooltip'});
Ext.get(this.id).next('img').set({qtip:'your tooltip'});
}
},

archmisha
21 Feb 2009, 3:15 AM
I am trying to add a tooltip to each value in the combo box.

Is it possible some how?

thanks

shuchia
10 Mar 2009, 11:43 AM
http://extjs.com/deploy/dev/examples/form/combos.html (http://extjs.com/deploy/dev/examples/form/combos.html)

joeri
19 Mar 2010, 2:30 AM
Another way, add this code in your TriggerField config :


id: 'myTriggerField',
listeners: {
render: function(c){
Ext.get(this.id).set({qtitle:'your title'});
Ext.get(this.id).set({qtip:'your tooltip'});
Ext.get(this.id).next('img').set({qtip:'your tooltip'});
}
},


You don't need to use the id:


qtip: 'your tooltip',
qtitle: 'your title',
listeners: {
render: function(c){
c.el.set({qtitle:c.qtitle});
c.el.set({qtip:c.qtip});
c.trigger.set({qtip:c.qtip});
}
},