Reputation: 908
I`m trying to define a combobox in ext.js with static values, but the displayed combobox, doens't show anything but 3 empty oprions.
here's the code:
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"
What am I doing wrong ?
Upvotes: 2
Views: 763
Reputation:
Try this instead:
xtype:"combo",
id: "user_flag",
fieldLabel: "Status",
labelStyle: "width:100px",
store: new Ext.data.SimpleStore({
fields: ["value", "name"],
data: [
["value":"-1","name":"Banned"], ["value":"0","name":"Inactive"], ["value":"1", "name":"Active"]
]
}),
disaplayField: "name",
valueField: "value",
selectOnFocus: true,
mode: 'local',
editable: false,
triggerAction: "all"
Upvotes: 0
Reputation: 1520
please follow the example of the next link
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()
});
Upvotes: 1