我在尝试加载json文件时遇到了一些问题,以便在Sencha Touch选择字段中实际加载值。在Sencha触摸中添加json数据到选择字段
我的代码的相关作品是:
Ext.regModel('d', {
fields: [{
name: 'Name', type: 'string'
}, {
name: 'id', type: 'int'
}]
});
Ext.regStore('TempStore', {
model: 'd',
autoLoad: true,
proxy: {
type: 'ajax',
url: '/sampledata.json',
reader: {
type: 'json',
root: 'd'
}
}
});
items: [{
xtype: 'selectfield',
label:'My Field',
id: 'Test',
name: 'Name',
store: 'TempStore',
displayField: 'Name',
valueField: 'id',
placeHolder: 'Select a Value'
}
我在相同的文件夹.js文件的samepledata.json文件和页面加载罚款,但是当我按下selectfield它带有一个空的列表。
任何想法?
编辑:错别字
嗯,试过这个,现在页面根本不加载。 – Calvin 2012-02-02 21:47:04
而不是Ext.regstore尝试var TempStore = new Ext.data.Store({model:'d',autoLoad:true,proxy:.....}); – riship89 2012-02-02 21:57:23
嗯,仍然无法正常工作。 (对于现场示例,您可以查看http://selectout.net/oil/app/,然后点击左侧添加数据,然后在顶部添加拖车设置,这会将您带到有该字段的页面)。 感谢您的帮助,但我真的很感激它 – Calvin 2012-02-02 22:08:06