Results 1 to 2 of 2

Thread: How to add TabPanel into Viewport

  1. #1
    Sencha User
    Join Date
    Mar 2010
    Posts
    249
    Answers
    2
    Vote Rating
    3
      0  

    Default Answered: How to add TabPanel into Viewport

    I've tried:

    app.js
    Code:
    Ext.Loader.setConfig({
        enabled: true
    });
    
    Ext.application({
        name: "Test",
    
        appFolder: "app",
    
        controllers: [
            "TestTabPanel"
        ],
    
        launch: function () {
            Ext.create("Test.view.Viewport", {
            });
        }
    });
    Viewport.js
    Code:
    Ext.define("Test.view.Viewport", {
        extend: "Ext.container.Viewport",
        layout: "fit",
        items: [
            {
                xtype: "testtabpanel"
            }
        ]
    });
    TestTabPanel.js
    Code:
    Ext.define("Test.controller.TestTabPanel", {
        extend: "Ext.tab.Panel",
        alias: "widget.testtabpanel",
        items: [
            {
                title: "Tab# 1"
            }, {
                title: "Tab# 2"
            }
        ],
    
        init: function () {
        },
    
        onLaunch: function () {
        }
    
    });
    Why should I add empty init and onLaunch?

  2. Your Test.controller.TestTabPanel extends Ext.tab.Panel. Your controllers should extend Ext.app.Controller and your views should use the Test.view namespace. Your controllers have to at least have the init method. It looks like you are trying to have a view act as a controller and view which is invalid.

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3932
    Vote Rating
    1272
      0  

    Default

    Your Test.controller.TestTabPanel extends Ext.tab.Panel. Your controllers should extend Ext.app.Controller and your views should use the Test.view namespace. Your controllers have to at least have the init method. It looks like you are trying to have a view act as a controller and view which is invalid.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •