2012-09-28 61 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() 
}); 
的例子