PDA

View Full Version : tbar with combobox and tooltip



Stephan123
9 Aug 2011, 2:29 AM
Hello !

I have a tbar.
In this tbar exist a combobox.
How can i set a tooltip for this combobox ?


tbar: [{
text: 'Bitte Hotel wählen: ',
xtype: 'tbtext'
},{
xtype: 'combo',
width: 150,
triggerAction: 'all',
displayField: 'property_name',
valueField: 'property_code',
store: hotelStore,
lazyRender:true,
hiddenName: 'property_code',
id: 'myHotel',
tooltip: 'Test'
}, ...

Who has an idea ?

Your sincerly

Stephan

Mycoding
9 Aug 2011, 2:45 AM
http://stackoverflow.com/questions/1793977/combo-box-items-tool-tip-not-displayed


Ext.QuickTips.init();
new Ext.form.ComboBox({
renderTo:Ext.getBody(),
tpl:'<tpl for="."><div ext:qtip="{abbr}" class="x-combo-list-item">{state}</div></tpl>',
store: sstore,
displayField:'state',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'Select a state...',
selectOnFocus:true,
forceSelection: true,
width:135
});


var statedata = [
['AL', 'Alabama'],
['AK', 'Alaska'],
['AZ', 'Arizona'],
['WV', 'West Virginia'],
['WI', 'Wisconsin'],
['WY', 'Wyoming']
];


var sstore = new Ext.data.SimpleStore({
fields: ['abbr', 'state'],
data : statedata
});

Stephan123
9 Aug 2011, 6:00 AM
Hello !

Thanks for the answer.
I look for a solution like this.


Ext.onReady(function(){
Ext.intercept(Ext.form.Field.prototype, 'initComponent', function(){
var fl = this.fieldLabel, h = this.helpText; if(h && h !== '' && fl){
this.fieldLabel = fl + '<span style="color: green;" ext:qtip="' + h + '"> <img src="/buttons/information.png"> </span>';
}
});
});


I would like to have an icon next to the item.

Your sincerly

Stephan