0
我正在使用ExtJS(3)并试图使用正在使用JSON查询的数据库中的记录填充组合框/下拉列表。使用JSON填充ExtJS组合框
这里是我的JSON电话:
var projectDropDown = new Ext.data.Store({
autoLoad: true,
url: 'dropdown.json',
storeId: 'projectDropDown',
idProperty: 'ProjectID',
fields: [ 'ProjectID', 'ProjectName' ]
});
然后我的组合框代码:
{
xtype: 'combo',
id: 'ProjectName',
fieldLabel: 'Project Name',
valueField: 'ProjectID',
displayField: 'ProjectName',
store: projectDropDown,
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'Select a Project...',
selectOnFocus:true
}
的JSON正在返回我的数据是这样的:
[
{
"ProjectID":"1",
"ProjectName":"Mike's Test Project"
},
{
"ProjectID":"2",
"ProjectName":"My Second Test Project"
},
{
"ProjectID":"3",
"ProjectName":"My Third Project"
},
{
"ProjectID":"6",
"ProjectName":"More testing from me"
}
]
我想我关闭,我只是没有看到我缺少什么来建立连接。
感谢您的任何帮助。
我怎么去chaning返回的JSON?我不知道该怎么做,或者叫做什么 – Mike
@Mike你不控制返回JSON的代码吗? –
@Mike或者实际上,现在我看到它只是从JSON文件中提取?只需编辑它就像一个文本文件 –