bsausser
18 Jul 2012, 1:35 PM
2 Days trying to follow the guides and examples...
index.html
...
<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">
<script type="text/javascript" src="extjs/ext-debug.js"></script>
<script type="text/javascript" src="app.js"></script>
...
app.js
Ext.application({
name: 'Ms2',
controllers: ['Main'],
autoCreateViewport: true,
launch: function () {
console.log('App lauch fired.');
}
});
Main.js
Ext.define('Ms2.controller.Main', {
extend: 'Ext.app.Controller',
models: ['Ms2.model.MsListModel'],
stores: ['Ms2.store.MsListStore'],
init: function () {
console.log('controller.Main initializing...');
}
});
MsListModel.js
Ext.define('Ms2.model.MsListModel', {
extend: 'Ext.data.Model',
fields: [
'Id',
'Title',
'ClientId',
'ClientTitle',
'SubmissionState',
'CreatedDate'
]
});
MsListStore.js
Ext.define('Ms2.store.MsListStore', {
extend: 'Ext.data.Store',
model: 'Ms2.model.MsListModel',
storeId: 'msListStore',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'data/mslist.json',
reader: {
type: 'json',
root: 'marketsubmissions',
successProperty: 'success'
}
},
load: function (me, records, successfull, opts) {
console.log('MsListStore load fired.');
console.log('MsListStore successfull: ' + successfull);
console.log('records: ' + records.length);
}
});
Chrome's console output:
controller.Main initializing... /app/controller/Main.js?_dc=1342646382836:9 (http://ms2dev.local/app/controller/Main.js?_dc=1342646382836)
Viewport initComponent fired. /app/view/Viewport.js?_dc=1342646382836:6 (http://ms2dev.local/app/view/Viewport.js?_dc=1342646382836)
App lauch fired. app.js:9 (http://ms2dev.local/app.js)
MsListStore load fired. /app/store/MsListStore.js?_dc=1342646382872:21 (http://ms2dev.local/app/store/MsListStore.js?_dc=1342646382872)
MsListStore successfull: undefined /app/store/MsListStore.js?_dc=1342646382872:22 (http://ms2dev.local/app/store/MsListStore.js?_dc=1342646382872)
Uncaught TypeError: Cannot read property 'length' of undefined /app/store/MsListStore.js?_dc=1342646382872:23 (http://ms2dev.local/app/store/MsListStore.js?_dc=1342646382872)
Running on IIS 7.5; I have also verified that the url is correct and will render JSON
Not sure what I am missing or not doing...Can somebody give me some direction?
Brian
index.html
...
<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">
<script type="text/javascript" src="extjs/ext-debug.js"></script>
<script type="text/javascript" src="app.js"></script>
...
app.js
Ext.application({
name: 'Ms2',
controllers: ['Main'],
autoCreateViewport: true,
launch: function () {
console.log('App lauch fired.');
}
});
Main.js
Ext.define('Ms2.controller.Main', {
extend: 'Ext.app.Controller',
models: ['Ms2.model.MsListModel'],
stores: ['Ms2.store.MsListStore'],
init: function () {
console.log('controller.Main initializing...');
}
});
MsListModel.js
Ext.define('Ms2.model.MsListModel', {
extend: 'Ext.data.Model',
fields: [
'Id',
'Title',
'ClientId',
'ClientTitle',
'SubmissionState',
'CreatedDate'
]
});
MsListStore.js
Ext.define('Ms2.store.MsListStore', {
extend: 'Ext.data.Store',
model: 'Ms2.model.MsListModel',
storeId: 'msListStore',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'data/mslist.json',
reader: {
type: 'json',
root: 'marketsubmissions',
successProperty: 'success'
}
},
load: function (me, records, successfull, opts) {
console.log('MsListStore load fired.');
console.log('MsListStore successfull: ' + successfull);
console.log('records: ' + records.length);
}
});
Chrome's console output:
controller.Main initializing... /app/controller/Main.js?_dc=1342646382836:9 (http://ms2dev.local/app/controller/Main.js?_dc=1342646382836)
Viewport initComponent fired. /app/view/Viewport.js?_dc=1342646382836:6 (http://ms2dev.local/app/view/Viewport.js?_dc=1342646382836)
App lauch fired. app.js:9 (http://ms2dev.local/app.js)
MsListStore load fired. /app/store/MsListStore.js?_dc=1342646382872:21 (http://ms2dev.local/app/store/MsListStore.js?_dc=1342646382872)
MsListStore successfull: undefined /app/store/MsListStore.js?_dc=1342646382872:22 (http://ms2dev.local/app/store/MsListStore.js?_dc=1342646382872)
Uncaught TypeError: Cannot read property 'length' of undefined /app/store/MsListStore.js?_dc=1342646382872:23 (http://ms2dev.local/app/store/MsListStore.js?_dc=1342646382872)
Running on IIS 7.5; I have also verified that the url is correct and will render JSON
Not sure what I am missing or not doing...Can somebody give me some direction?
Brian