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,414
    Answers
    3898
    Vote Rating
    1269
      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!

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

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Posting Permissions

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