View Full Version : [2.0b1][SOLVED] ComboBox default store fields

17 Oct 2007, 7:12 AM
The API docs for the combo box say that when mode='local', displayField should default to 'text' and valueField should default to 'value'. If that is the case then the following code should work:

new Ext.form.ComboBox({
mode: 'local',
//displayField: 'text',
//valueField: 'value',
store: new Ext.data.SimpleStore({
fields: ['value', 'text'],
data: [['1','Caption 1'],['2','Caption 2']]

But what I see is that it doesn't work unless I set (i.e. uncomment in the code above) the displayField and valueField config options.

I suggest the following fix to Combo.js at line 256:

this.selectedIndex = -1;
if(this.mode == 'local'){
if(this.initialConfig.queryDelay === undefined){
this.queryDelay = 10;
if(this.initialConfig.minChars === undefined){
this.minChars = 0;
this.valueField = this.valueField || 'value';
this.displayField = this.displayField || 'text';

Thank you for your time.

(Also see http://extjs.com/forum/showthread.php?t=15084)

18 Oct 2007, 6:06 PM
Thank you for reporting; it will be fixed soon.

20 Oct 2007, 7:34 AM
This is a doc error. It always defaults to undefined unless tranforming a select. The docs should read:

The underlying data field name to bind to this CombBox (defaults to undefined if mode = 'remote' or 'text' if transforming a select)