【发布时间】:2012-11-13 17:14:59
【问题描述】:
这是我得到的 json 响应。我检查了 JSONLINT,它说有效,但如果你注意到它只给了我没有列标题的价值......列名是“States”。
{"myTable":["VA","CA","CO","OK","PA","TX"]}
是否可以使用此 Json 加载到我的组合框中
items: [{
xtype: 'combo',
id: 'iccombo',
scope: this,
store: this.store,
mode: 'remote',
minChars: 0,
fieldLabel: 'Short State',
displayField: 'States',
valueField: 'States',
typeAhead: true,
name: 'States',
labelWidth: 125,
anchor: '95%'
},
这是我的店
var store = Ext.create('Ext.data.Store', {
autoLoad: true,
id: 'OurData',
scope: this,
fields: [{ name: 'States' }],
proxy: {
type: 'ajax',
url: 'GetState/getS',
reader: {
type: 'json',
root: 'myTable'
idProperty: 'States'
}
}
});
【问题讨论】:
-
您可能需要使用 ArrayStore 代替 docs.sencha.com/ext-js/4-1/#!/api/Ext.data.ArrayStore
-
你甚至可以内联数据:store:["VA","CA",...]
-
谢谢 dbrin...我的问题是我使用了一个返回 json 格式的控制器...我正在考虑更换我的控制器
标签: json extjs extjs4 extjs4.1