0
我無法弄清楚我的代碼在jsfiddle上出了什麼問題。我試圖創建一個減少文件與Ext-JS的錯誤。這是我正在使用的代碼。 http://jsfiddle.net/qGBYT/jsfiddle上使用/ echo/json的Ext.view.View的簡單示例
Ext.define('test.Model', {
extend: 'Ext.data.Model',
fields: ['id'],
idProperty: 'id',
proxy: {
// Have also tried 'ajax'
type: 'rest',
url: '/echo/json',
reader: {
type: 'json',
root: 'records'
}
}
},
function(){
var store = new Ext.data.Store({model:'test.Model'});
var list = new Ext.view.View({
itemTpl: '<div>{id}</div>',
renderTo: Ext.getBody(),
width: 300,
height: 500,
store: store
});
store.load({params: {json: '{"records":[{"id":1}]'}});
});
該錯誤消息我得到的是
Uncaught TypeError: Cannot read property 'type' of undefined
這是由上面的代碼
你可以發佈一個鏈接到你的小提琴嗎? – sha
D'oh http://jsfiddle.net/qGBYT/ –
對不起...我試圖從回調之外移動你的商店創建代碼,它工作正常 - http://jsfiddle.net/qGBYT/11/ – sha