這是我得到的json響應。我用JSONLINT進行了檢查,它說有效,但如果你注意到它只給我值而沒有列的標題......列名是「States」。使用單個值json到extjs combobox
{"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而非http:/ /docs.sencha.com/ext-js/4-1/#!/api/Ext.data.ArrayStore – dbrin
甚至可以內聯數據:store:[「VA」,「CA」,...] – dbrin
謝謝dbrin ...我的問題是使用一個控制器,返回該JSON格式... m想改變我的控制器 – EagleFox