2012-09-28 32 views
2

我试图用静态值在ext.js中定义一个组合框,但是显示的组合框没有显示任何内容,而只显示了3个空的选项。ext.js combobox没有值

下面的代码:

xtype:"combo", 
id: "user_flag", 
fieldLabel: "Status", 
labelStyle: "width:100px", 
store: new Ext.data.SimpleStore({ 
      fields: ["value", "name"], 
      data: [ 
        ["-1","Banned"], ["0", "Inactive"], ["1", "Active"] 
        ] 
      }), 
disaplayField: "name", 
valueField: "value", 
selectOnFocus: true, 
mode: 'local', 
editable: false, 
triggerAction: "all" 

我在做什么错?

回答

0

请按照下一个环节

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.field.ComboBox

// 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() 
}); 
的例子