PDA

View Full Version : Sencha Touch issue: This.addEvents is not a a function 'bodyresize'



luisparada
25 Apr 2011, 6:34 AM
I'm building a MVC sencha touch application and I'm stock in this error:
this.addEvents is not a function
'bodyresize'
in sencha-touch-debug.js line 21314 this is the sencha touch piece of code:


initComponent : function() {
this.addEvents(
'bodyresize'


Now, this are all my files with just a single view:
index.php


<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Wayne County MOBILE</title>

<!-- Sencha Touch CSS -->
<link rel="stylesheet" href="css/sencha-touch.css" type="text/css">
</head>
<body>
<script type="text/javascript" src="lib/sencha-touch-debug.js"></script>

<div id="sencha-app">
<script type="text/javascript" src="app/app.js"></script>

<!-- Place your model files here -->
<div id="sencha-models">
<script type="text/javascript" src="app/models/models.js"></script>
<script type="text/javascript" src="app/stores/stores.js"></script>

</div>

<!-- Place your view files here -->
<div id="sencha-views">
<script type="text/javascript" src="app/views/Events.js"></script>
<script type="text/javascript" src="app/views/Menu.js"></script>
<script type="text/javascript" src="app/views/Viewport.js"></script>
</div>

<!-- Place your controller files here -->
<div id="sencha-controllers">
<script type="text/javascript" src="app/controllers/controllers.js"></script>
</div>
</div>
</body>
</html>


App.js


Ext.regApplication({
name:"wayne",
launch:function(){
this.views.viewport = new this.views.Viewport();
}
});


Events.js


wayne.views.Events = Ext.extend(Ext.Panel,{
dockedItems:[{
xtype:'toolbar',
title:'Events',
dock:'top',
items:[{
xtype:'button',
text:'Back',
ui:'back',
handler:function(){
/*Ext.dispatch({
controller:wayne.controllers.wayneController,
action:'backToIndex'
});*/
},
scope:this
}]
}],
items:[{
xtype:'list',
emptyText:'No Data Available',
store:wayne.stores.wayneEvents,
itemTpl:'{title}',
onItemDisclosure:function(record){
/*Ext.dispatch({
controller:wayne.controllers.wayneController,
action:'showDetail',
data:record.data
});*/
},
grouped:false,
scroll:'vertical',
fullscreen:true
}],
initComponent: function(){
wayne.views.Events.superclass.initComponent.apply(this.arguments);
}
});


Viewport.js


wayne.views.Viewport = Ext.extend(Ext.Panel,{
fullscreen:true,
layout:'card',
cardSwitchAnimation:'slide',
initComponent:function(){
Ext.apply(wayne.views,{
Events: new wayne.views.Events(),
Menu: new wayne.views.Menu()
});

Ext.apply(this,{
items:[
wayne.views.Events,
wayne.views.Menu
]
});

wayne.views.Viewport.superclass.initComponent.apply(this, arguments);
},
layoutOrientation: function(orientation, w, h){
wayne.views.Viewport.superclass.layoutOrientation.call(this, orientation, w, h)
}
});


Menu.js


wayne.views.Menu = Ext.extend(Ext.TabPanel, {
dockedItems: [{
xtype: 'toolbar',
title: 'Home'
}],
tabBar:{
dock:'bottom',
layout:{
pack:'center'
}
},

items: [
{text:'menu 1', iconCls:'home'},
{text:'menu 2', iconCls:'home'},
{text:'menu 3', iconCls:'home'}
],

initComponent: function() {
wayne.views.Menu.superclass.initComponent.apply(this, arguments);
}
});



controllers.js


wayne.controllers.wayneController = new Ext.Controller({

index: function(options){
wayne.views.Viewport.setActiveItem(
wayne.views.Events,options.animation
);
}

})


models.js


Ext.regModel("wayne.models.Events",{
fields:[
{name:'id', type:'int'},
{name: 'title', type:'string'},
{name:'highlight', type:'int'},
{name:'start-date', type:'date'},
{name:'end-date', type:'date'},
{name:'description', type:'string'},
{name:'active', type:'int'},
{name:'eventtime', type:'string'},
{name:'location', type:'string'},
{name:'website', type:'string'},
{name:'contact', type:'string'}
]
});


stores.js


wayne.stores.wayneEvents = new Ext.data.Store({
model:'wayne.models.Events',
proxy:{
type:'ajax',
url:'module.php',
extraParams:{
start:1,
end:10,
module:'events',
task:'getEvents'
},
reader:{
root:'rows'
}
}
})


I honnestly don't have a clue about what's going on, I have also try to find something related in the forums but still no results.
thanks and I'm sorry for including the complete application code.
PD: In the last test I did, I exclude events.js and the application worked..