1. #1
    Sencha User
    Join Date
    Jun 2009
    Posts
    58
    Vote Rating
    0
    vivendi is on a distinguished road

      0  

    Default controllers and views

    controllers and views


    I'm trying to create a basic mvc app with sencha touch 2. I have a few basic parts ready. The app.js and a controller, which load and run good. But all i need to do now is to add a view. But this is where the problem starts.

    When i try to add a view to my controller, then it displays the following error in console:
    GET file:///xcode/TEST_MVC/www/AM/view/User.js?_dc=1318501436195
    I have no idea why i'm getting this error. As far as i can see i did exactly what the example apps are doing.

    Please take a look at my code:

    This is my controller:
    PHP Code:
    Ext.define('AM.controller.Main', {
        
    extend'Ext.app.Controller',
        
    views: ['User'],  // <--- This is causing the error
        
    init: function() {
            
    this.control({
                 
    console.log("init");
            });
        },

    }); 
    And this is my view:
    PHP Code:
    Ext.define('AM.view.User' ,{
        
    extend'Ext.Panel',
        
    fullscreentrue,
        
    html'dfgfahsg'
    }); 
    So when i remove this line from my controller:
    views: ['User']

    Then my app runs fine, without errors... But that is how i try to 'add' my view to my controller.
    For some reason it then looks in the "/AM/" folder, which is just the name i defined in app.js.

    Anyone any idea what i'm doing wrong here...?

  2. #2
    Sencha User
    Join Date
    Jun 2009
    Posts
    58
    Vote Rating
    0
    vivendi is on a distinguished road

      0  

    Default


    Just figured out i was still adding <script> references to my .js files. Which ofcourse isn't needed with sencha touch 2

    Anyway, now i'm trying to load a panel (which are called Components now?) from a view. But it's not showing.

    This is my app.js
    Code:
    Ext.Loader.setConfig({ enabled: true });
    
    Ext.application({
        name: 'AM',
        appFolder: 'app',
        controllers: [
            'Main'
        ],
        launch: function() {
            Ext.create('Ext.viewport.Viewport', {
                fullscreen: true,
                items: {
                    xtype: 'userlist'
                }
            });
        }
    });
    This is my controller:
    Code:
    Ext.define('AM.controller.Main', {
        extend: 'Ext.app.Controller',
        views : ['User']
    });
    And this is my view:
    Code:
    Ext.define('AM.view.User', {
        extend: 'Ext.Component',
        xtype: 'userlist',
        html: 'aafgvhfghfghfghfa'
    });

    But for some reason the 'User' view isn't showing. I do see that my background has the faint grey tint, which indicates Sencha loaded succesfully.

    But if i change the "items:" in app.js to this, then a panel renders just fine:
    Code:
        ...
                items: [
                    //xtype: 'userlist'
                        xtype: 'panel',
                        title: 'Users',
                        html : 'List of users will go here'
                }
        ...
    So my question basically is, how can i render a panel when it is in a separate file like i have now (User.js)???

  3. #3
    Sencha User
    Join Date
    Jun 2009
    Posts
    392
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default


    I am also facing this problem as posted here in the Q&A forum => http://www.sencha.com/forum/showthre...on-of-Tabpanel

  4. #4
    Sencha User
    Join Date
    Jun 2009
    Posts
    58
    Vote Rating
    0
    vivendi is on a distinguished road

      0  

    Default


    Quote Originally Posted by parky128 View Post
    I am also facing this problem as posted here in the Q&A forum => http://www.sencha.com/forum/showthre...on-of-Tabpanel
    Just looked at your example and noticed you're trying to load a tabPanel. So i changed my view to this:

    Code:
    Ext.define('AM.view.User', {
        extend: 'Ext.TabPanel',
        xtype: 'userlist',
        items: [{
            xtype: 'panel',
            html: 'djhfdsjk'
        }]
    });
    Now when i launch my app then i DO see a toolbar at the top of my page, but i don't see the html content below that... So if anyone has any idea..

  5. #5
    Sencha User
    Join Date
    Jun 2009
    Posts
    392
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default


    Yeah I can only conclude its something to do with the xtype lookup not working correctly. I have an ExtJS 4 MVC app laid out in a similar manner which works fine, so I'm a bit stumped!

  6. #6
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    9
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    Vivendi, could you maybe zip up your app and post it? The easiest way for us to debug this is to get the exact same app (structure + code).

  7. #7
    Sencha User
    Join Date
    Jun 2009
    Posts
    58
    Vote Rating
    0
    vivendi is on a distinguished road

      0  

    Default


    Quote Originally Posted by TommyMaintz View Post
    Vivendi, could you maybe zip up your app and post it? The easiest way for us to debug this is to get the exact same app (structure + code).
    Sure thing, i'll post it tomorrow when i have access to my mac again.

  8. #8
    Sencha User
    Join Date
    Jun 2009
    Posts
    392
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default


    Vivendi - Hope you dont mind me butting in here, but see my attached app attached for you guys to debug, having same xtype related issues as mentioned in my earlier post on this thread.

  9. #9
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    9
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    I haven't tried the app yet, but I see you guys are not using the config object in the view definitions. Does the answer in this thread help fix the problem?

    http://www.sencha.com/forum/showthre...on-of-Tabpanel

  10. #10
    Sencha User
    Join Date
    Jun 2009
    Posts
    392
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default


    Yes, sorry I have posted in both forums with the same problem. Thanks again for your help here!

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar