0
votes

I am new to sencha touch mvc framework and i am using version1.1.1 on android os.I have created controller and view in my demo app.I am getting error in my app.js and viewport.js.

Here's app.js:-

Ext.regApplication({
    name: 'MyApp',
    defaultUrl: 'Home/index',
    launch: function()
    {
        this.viewport = new MyApp.view.viewport();
    },
});

and here's viewport.js:-

MyApp.view.viewport = Ext.extend(Ext.Panel,{

   fullscreen: 'true',
   layout: 'card',
   cardSwitchAnimation: 'slide',
   dockedItems: [
   {
    xtype: 'toolbar',
    title: 'MvcTouch',
   },
   ],
});

Now my problem is that when i run my app with above pieces of codes i am getting the following errors.

1) TypeError: Result of expression 'MyApp.view' [undefined] is not an object. at file:///android_asset/www/app/view/viewport.js:9

2) TypeError: Result of expression 'MyApp.view' [undefined] is not an object. at file:///android_asset/www/app/app.js:6

I write the code according to the standards explained here by Sencha's core developer .But when i change the line

MyApp.view.viewport = Ext.extend(Ext.Panel,{

to

viewport = Ext.extend(Ext.Panel,{ in viewport.js

and change the line

this.viewport = new MyApp.view.viewport();

to

this.viewport = new viewport(); in app.js

the app works well.Now I dont understand about the code that it works well when i am not using standard conventions of sencha and does not work when i used the standard convention. Can anybody tell me what's happening here.Any help would be highly appreciated.Thanx in advance.

1

1 Answers

1
votes

In Sencha Touch 1.1.1, the app views are defined with "views" not "view". So, try this:

MyApp.views.viewport = Ext.extend(Ext.Panel,{

This should work fine then.