Threaded View

  1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    143
    Vote Rating
    0
    Answers
    5
    rockinthesixstring is on a distinguished road

      0  

    Default Answered: Stuck trying to load a view

    Answered: Stuck trying to load a view


    I'm trying my hand at ST2 and I'm stuck on the most basic of bits. I'm simply trying to load a View and I'm not sure how.

    index.js
    Code:
    Ext.application({    name: 'rpc',
        defaultUrl: 'home/index',
        controllers: ['home'], //note: define controllers here
        launch: function () {
            console.log('Ext.application ~ launch'),
            Ext.create('Ext.TabPanel', {
                id: 'rpc-rootPanel',
                fullscreen: true,
                tabBarPosition: 'bottom',
                items: [{
                    title: 'Home',
                    iconCls: 'home'
                }]
            });
        }
    });
    home controller
    Code:
    Ext.define('rpc.controller.home', {    extend: 'Ext.app.Controller',
        views: ['home.index'],
        init: function () {
            console.log('rpc.controller.home ~ init');
        }
    });
    home/index view
    Code:
    Ext.define('rpc.view.home.index', {    extend: 'Ext.Panel',
        id: 'rpc-view-home-index',
        title: 'Home',
        layout: {
            type: 'vbox',
            align: 'stretch'
        },
        defaults: { style: 'margin-bottom: 5px' },
        config: {
            fullscreen: true,
            items: [{
                xtype: 'button',
                text: 'Videos',
                handler: function () {
                    Ext.redirect('video.index');
                }
            }],
            html:'test'
        }
    });

  2. I would suggest reading the following articles:

    http://www.sencha.com/learn/architec...xt-js-4-part-1
    http://www.sencha.com/learn/architec...xt-js-4-part-2
    http://www.sencha.com/learn/architec...xt-js-4-part-3

    The only difference between ExtJS 4 and ST2 is that in ST2 you have to define the view configuration inside of the config: {} object. Other then that those articles apply directly to ST2.

Thread Participants: 1