PDA

View Full Version : How to make a tooltip in a combo



rafaelrp
29 May 2012, 6:34 AM
Heelo,
I'm trying to put a tooltip into a combo,
i've tried to make this example but without succsess
http://dev.sencha.com/deploy/ext-4.0.0/examples/form/combos.html

M (http://dev.sencha.com/deploy/ext-4.0.0/examples/form/combos.html)y combo.


{
fieldLabel : 'Ativo',
name : 'selAtivo',
id : 'selAtivo',
width : 200,
xtype : 'combo',
editable : false,
allowBlank : false,
displayField : 'ativo',
valueField : 'value',
listConfig: {
getInnerTpl: function() {
return '<div data-qtip="{grupo}">{grupo}</div>';
}
},

store : Ext.create('Ext.data.Store', {
fields : ['ativo', 'value'],
data : [
{ativo : 'Sim', value : 1},
{ativo : 'N&atilde;o', value : 2}
]
})
}


Thanks !~o)

redraid
29 May 2012, 6:53 AM
Before using tag-based quick tips you need to init QuickTip singleton:


// Init the singleton. Any tag-based quick tips will start working.
Ext.tip.QuickTipManager.init();

// The data store containing the list of states
var states = Ext.create('Ext.data.Store', {
fields: ['abbr', 'name'],
data : [
{"abbr":"AL", "name":"Alabama"},
{"abbr":"AK", "name":"Alaska"},
{"abbr":"AZ", "name":"Arizona"}
//...
]
});

// Create the combo box, attached to the states data store
Ext.create('Ext.form.ComboBox', {
fieldLabel: 'Choose State',
store: states,
queryMode: 'local',
displayField: 'name',
valueField: 'abbr',
renderTo: Ext.getBody(),
listConfig: {
getInnerTpl: function (displayField) {
return '<div data-qtip="{abbr}">{' + displayField + '}</div>';
}
}
});

rafaelrp
29 May 2012, 8:24 AM
Work !

Thanks !