View Full Version : How to display something besides displayField in combobox

5 Feb 2014, 12:58 PM
I assumed there would be some kind of renderer function for combobox, but there is not. I need to display more than just one of my values in the comboBox. My model fields are id and name and I would like to display them as id : name in the combobox. How would I make this happen?

5 Feb 2014, 1:33 PM
There's an example of it in the docs: http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.form.field.ComboBox

5 Feb 2014, 1:41 PM
You can update the listConfig:

name: 'Fiddle',

launch: function() {

var states = Ext.create('Ext.data.Store', {
fields: ['abbr', 'name'],
data: [{
"abbr": "AL",
"name": "Alabama"
}, {
"abbr": "AK",
"name": "Alaska"
}, {
"abbr": "AZ",
"name": "Arizona"

Ext.create('Ext.form.ComboBox', {
fieldLabel: 'Choose State',
store: states,
queryMode: 'local',
displayField: 'name',
valueField: 'abbr',

listConfig: {
itemTpl: '{abbr} - {name}'

renderTo: Ext.getBody()