I`m learning Extjs and trying to follow this tutorial http://www.sencha.com/learn/the-mvc-application-architecture/ Everything went well.. But when I continue to Creating a Model and a Store and do as written in tutorial then run it. It give error : Uncaught TypeError: Cannot read property items of undefined Is there is something I missed up? Thank you
/app/ Controller/User.js
Ext.define( AM.controller.Users , {
extend: Ext.app.Controller ,
stores: [
Users ],
models: [ User ],
views: [
user.List ,
user.Edit ],
init: function () {
this.control({
viewport > panel : {
render: this.onPanelRendered
},
userlist : {
itemdblclick: this.editUser
}
});
},
editUser: function (grid, record) {
var view = Ext.widget( useredit );
view.down( form ).loadRecord(record);
},
onPanelRendered: function () {
console.log( panel rendered );
}
})
/app/model/User.js
Ext.define( AM.model.User , {
extend: Ext.data.Model ,
fields: [ name , email ]
});
/app/store/Users.js
Ext.define( AM.store.Users , {
extend: Ext.data.Store ,
model: AM.model.User ,
data: [
{name: Ed , email: ed@sencha.com },
{name: Tommy , email: tommy@sencha.com }
]
});
/app/view/user/Edit.js
Ext.define( AM.view.user.Edit , {
extend: Ext.window.Window ,
alias : widget.useredit ,
title : Edit User ,
layout: fit ,
autoShow: true,
initComponent: function() {
this.items = [
{
xtype: form ,
items: [
{
xtype: textfield ,
name : name ,
fieldLabel: Name
},
{
xtype: textfield ,
name : email ,
fieldLabel: Email
}
]
}
];
this.buttons = [
{
text: Save ,
action: save
},
{
text: Cancel ,
scope: this,
handler: this.close
}
];
this.callParent(arguments);
}
});
/app/view/user/List.js
Ext.define( AM.view.user.List ,{
extend: Ext.grid.Panel ,
alias: widget.userlist ,
store: Users ,
title: All users ,
});
/myapp.js
Ext.application({
name: AM ,
controllers : [ Users ],
appFolder: app ,
launch: function() {
Ext.create( Ext.container.Viewport , {
layout: fit ,
items: [
{
xtype: userlist ,
}
]
});
}
});
/index.html
<!DOCTYPE HTML>
<html>
<head>
<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="myapp.js"></script>
</head>
<body>
Loading apps.........
</body>
</html>
Extjs library is located at /extjs