我必须使用从PHP接收的JSON数据在ExtJS 4.2中填充组合框。 到目前为止的代码: 数据存储:使用JSON填充组合框ExtJS 4.2
var Cstates = new Ext.data.Store({
autoLoad: true,
url: 'data.php',
storeId: 'Cstates',
reader: new Ext.data.JsonReader({
root: 'state'
}),
idProperty: 'abbr',
fields: ['abbr', 'name']
});
组合框:
{
xtype: 'combo',
id: 'cmbState',
fieldLabel: ' Select state :',
triggerAction: 'all',
store: Cstates,
queryMode: 'local',
valueField: 'abbr',
displayField: 'name',
triggerAction: 'all',
typeAhead: true,
emptyText: '* All States',
forceSelection: true,
selectOnFocus: true,
allowBlank: false,
selectOnTab: true,
//hidden: true,
disabled: true
}
JSON收到:
{state:[{"abbr":"E1","name":"EAST1"},{"abbr":"E2","name":"EAST2"}]}
而且以后我需要填充此组合框与将要返回的其他值从相同的格式从一个PHP使用GET即data.php?region = EAST。
所以究竟是什么问题?你有尝试过什么吗?你有什么错误或什么? – lascort
你在看如何从新的URL重新加载'商店'? – weeksdev
已经尝试了像JSONReader这样的东西,但都没有工作,上面的代码不会填充组合框,甚至萤火虫显示没有GET请求被解雇的PHP。 – user2612159