Results 1 to 4 of 4

Thread: Incredibly simple toolbar config question

  1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    2
    Vote Rating
    0
      0  

    Default Answered: Incredibly simple toolbar config question

    I am building a test app with sencha touch 2.

    For some reason, I cannot add a tab panel as an item to a global container added to the viewport. My app.js file initializes the viewport, adds the 'Main.js' view to it. Here is the source code that works, slightly (see the bottom, sorry for horrid indenting).

    Ext.define('Test.view.Main',{
    extend: 'Ext.Container',
    requires: [
    'Test.view.Home',
    'Test.view.MyTabView'
    ],
    fullscreen: true,
    config: {


    items: [
    {
    xtype: 'mytabview'

    }

    ]
    }

    });
    This at least initializes the the tab view properly, which is stored in a seperate view file, Test.view.MyTabView. (source below)

    Ext.define('Test.view.MyTabView',{
    extend: 'Ext.TabPanel',
    fullscreen: true,
    xtype: 'mytabview',
    requires: 'Test.view.Home',
    config: {
    defaults: {
    styleHtmlContent: true
    },
    tabBarPosition: 'bottom',
    docked: 'bottom',
    items: [
    {
    xtype: 'homepanel'
    }
    ]
    }
    });
    But when i combine the two, inline, nothing works anymore. Of course i could and should keep it in a separate file for better organization, but it is important to my understanding of the framework itself as to why this isnt working. (source below).

    Ext.define('Test.view.Main',{
    extend: 'Ext.Container',
    requires: [
    'Test.view.Home',
    'Test.view.MyTabView'
    ],
    fullscreen: true,
    config: {


    items: [
    {
    fullscreen: true,
    xtype: 'mytabview',
    requires: 'Test.view.Home',
    config: {
    defaults: {
    styleHtmlContent: true
    },
    tabBarPosition: 'bottom',
    docked: 'bottom',
    items: [
    {
    xtype: 'homepanel'
    }
    ]
    }

    }

    ]
    }
    });
    NOTE: Neither of these implementations also correctly render the HTML inside the provided tab objects into the viewport. homepanel is an xtype of a Panel defined in Test.view.Home, but even defining an inline panel doesnt work.

    javascript sencha sencha-touch-2 javascript-objects

  2. Something more like this:

    Code:
    Ext.define('Test.view.Main', {
        extend     : 'Ext.Container',
        requires   : [
            'Test.view.Home',
            'Test.view.MyTabView'
        ],
        config     : {
            layout : 'fit',
            items  : [
                {
                    xtype          : 'mytabview',
                    defaults       : {
                        styleHtmlContent : true
                    },
                    tabBarPosition : 'bottom',
                    items          : [
                        {
                            xtype : 'homepanel'
                        }
                    ]
                }
            ]
        }
    });
    Although looking at this class, it's overnesting. Since Test.view.Main only has a single item (the mytabview) you then don't need the Test.view.Main class.

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

    Default

    2 things, remove the fullscreen configs. Also, child items shouldn't use the config object, have the configs outside of the config object for the mytabview item config (also remove the requires property)
    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

  4. #3
    Sencha User
    Join Date
    Aug 2012
    Posts
    2
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by mitchellsimoens View Post
    2 things, remove the fullscreen configs. Also, child items shouldn't use the config object, have the configs outside of the config object for the mytabview item config (also remove the requires property)
    I'm sorry, but could you please provide an example? I did what you said but unfortunately could not get it working.

  5. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      1  

    Default

    Something more like this:

    Code:
    Ext.define('Test.view.Main', {
        extend     : 'Ext.Container',
        requires   : [
            'Test.view.Home',
            'Test.view.MyTabView'
        ],
        config     : {
            layout : 'fit',
            items  : [
                {
                    xtype          : 'mytabview',
                    defaults       : {
                        styleHtmlContent : true
                    },
                    tabBarPosition : 'bottom',
                    items          : [
                        {
                            xtype : 'homepanel'
                        }
                    ]
                }
            ]
        }
    });
    Although looking at this class, it's overnesting. Since Test.view.Main only has a single item (the mytabview) you then don't need the Test.view.Main class.
    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

Tags for this Thread

Posting Permissions

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