Matrym
Matrym

Reputation: 17073

Nested Panels / Toolbars in Sencha Touch

I'm trying to create a constant bottom toolbar, which controls a panel above it. Then the panel above it should have a toolbar of its own (at the top). I've attempted the below code, which almost works, but I can't see the html of the sub-page inner panels. I think it's because the panel isn't taking up the remaining height, but I don't know why.

Anyone have any ideas? Thanks!

Ext.setup({
    onReady: function() {


    // Sub-page sections
    var blah = {
        style: "background-color: #B22222; color:#FF0000;",
        title: "one",
        html: "Why can't I see this html",
        layout:"fit",
        flex: 1
    };
    var blah2 = {
        style: "background-color: #404040; color:#000000;",
        title: "one",
        html: "Why can't I see this html",
        layout:"fit",
        flex: 1
    };  

    // Main portion of the page, which includes top toolbar and content
    var page1 = new Ext.TabPanel({
        dock: "bottom",
        layout: "card",
        items: [blah, blah2, blah],
        title: "one",
        flex: 1
    });

    // This is the outer panel with the bottom toolbar
    var wrapper = new Ext.Panel({
        fullscreen: true,
        items: page1,
        dockedItems: [
          {
            xtype: "toolbar",
            dock: "bottom",
            items: [
              {
                iconMask: true,
                iconCls: "download"
              },
              {
                iconMask: true,
                iconCls: "favorites"
              },
              {
                iconMask: true,
                iconCls: "search"
              },
              {
                iconMask: true,
                iconCls: "user"
              }
            ]  
          }
        ]
      });
    }
});

Upvotes: 1

Views: 7056

Answers (2)

nelstrom
nelstrom

Reputation: 19562

It sounds like what you are trying to do can be done using a TabPanel, rather than a Toolbar. When you dock the tabBar to the bottom, each tabButton can accept an icon.

I may have misunderstood what you are trying to do, but this should help:

Ext.setup({
    onReady: function() {


        // Sub-page sections
        var blah = {
            style: "background-color: #B22222; color:#FF0000;",
            title: "one",
            html: "Why can't I see this html",
        };
        var blah2 = {
            style: "background-color: #404040; color:#000000;",
            title: "one",
            html: "Why can't I see this html",
        };  

        // Main portion of the page, which includes top toolbar and content
        var page1 = new Ext.TabPanel({
            items: [blah, blah2, blah],
            title: "one",
            iconMask: true,
            iconCls: "download",
        });

        // This is the outer panel with the bottom toolbar
        var wrapper = new Ext.TabPanel({
            fullscreen: true,
            tabBar: {
                dock: 'bottom',
                layout: {
                    pack: 'center'
                }
            },
            items: [
                page1,
                {
                    iconMask: true,
                    iconCls: "favorites"
                },
                {
                    iconMask: true,
                    iconCls: "search"
                },
                {
                    iconMask: true,
                    iconCls: "user"
                }
            ]
        });
    }
});

I made a screencast about building a user interface in sencha touch using tabs and toolbars. There's a live demo, and the code is on github, so feel free to use that as a reference.

Upvotes: 8

Mike
Mike

Reputation: 11

take the

layout: "card",

out of the page1 TabPanel, and place it in the wrapper Panel instead

Upvotes: 1

Related Questions