Results 1 to 2 of 2

Thread: Menu Best way to display

  1. #1
    Sencha User
    Join Date
    Mar 2010
    Posts
    13
    Vote Rating
    0
      0  

    Default Answered: Menu Best way to display

    Hello,

    I am new to Sencha Touch and i would like to know the best way to display a menu looking like the attached mage.

    Hbox displaying 2,3 or 4 icons in a row then adding the next 2,3 or 4 icons on the second row.
    if there are more icons after these 2 rows i would like the remaining icons on the next page using the carousel to slide to the right viewing the other icons.

    Is this possibile and what would be the best way to do this ?

    • Carousel
      • Hbox Slide 1
        • Row with icons
        • Row with icons
      • Hbox Slide 2
        • Row with icons
        • Row with icons



    financial-app-07.jpg

  2. You could do this with pure CSS or if you want to stay within the confines of layouts then you can use 3 containers using vbox, which will give you the rows, and each row uses hbox to give the columns.

    Here is a quick CSS that I needed to use, just some color and a margin:

    Code:
    .cell {
        background : #000000;
        color      : #FFFFFF;
        margin     : 1em;
    }
    Here is the quick demo:

    Code:
    Ext.Viewport.add({
        layout : {
            type  : 'vbox',
            align : 'stretch'
        },
        items  : [
            {
                flex   : 1,
                layout : {
                    type  : 'hbox',
                    align : 'stretch'
                },
                items  : [
                    {
                        flex : 1,
                        html : '1.1',
                        cls  : 'cell'
                    },
                    {
                        flex : 1,
                        html : '1.2',
                        cls  : 'cell'
                    },
                    {
                        flex : 1,
                        html : '1.3',
                        cls  : 'cell'
                    }
                ]
            },
            {
                flex   : 1,
                layout : {
                    type  : 'hbox',
                    align : 'stretch'
                },
                items  : [
                    {
                        flex : 1,
                        html : '2.1',
                        cls  : 'cell'
                    },
                    {
                        flex : 1,
                        html : '2.2',
                        cls  : 'cell'
                    },
                    {
                        flex : 1,
                        html : '2.3',
                        cls  : 'cell'
                    }
                ]
            },
            {
                flex   : 2,
                layout : {
                    type  : 'hbox',
                    align : 'stretch'
                },
                items  : [
                    {
                        flex : 1,
                        html : '3.1',
                        cls  : 'cell'
                    },
                    {
                        flex : 1,
                        html : '3.2',
                        cls  : 'cell'
                    },
                    {
                        flex : 1,
                        html : '3.3',
                        cls  : 'cell'
                    }
                ]
            }
        ]
    });

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,413
    Answers
    3898
    Vote Rating
    1266
      1  

    Default

    You could do this with pure CSS or if you want to stay within the confines of layouts then you can use 3 containers using vbox, which will give you the rows, and each row uses hbox to give the columns.

    Here is a quick CSS that I needed to use, just some color and a margin:

    Code:
    .cell {
        background : #000000;
        color      : #FFFFFF;
        margin     : 1em;
    }
    Here is the quick demo:

    Code:
    Ext.Viewport.add({
        layout : {
            type  : 'vbox',
            align : 'stretch'
        },
        items  : [
            {
                flex   : 1,
                layout : {
                    type  : 'hbox',
                    align : 'stretch'
                },
                items  : [
                    {
                        flex : 1,
                        html : '1.1',
                        cls  : 'cell'
                    },
                    {
                        flex : 1,
                        html : '1.2',
                        cls  : 'cell'
                    },
                    {
                        flex : 1,
                        html : '1.3',
                        cls  : 'cell'
                    }
                ]
            },
            {
                flex   : 1,
                layout : {
                    type  : 'hbox',
                    align : 'stretch'
                },
                items  : [
                    {
                        flex : 1,
                        html : '2.1',
                        cls  : 'cell'
                    },
                    {
                        flex : 1,
                        html : '2.2',
                        cls  : 'cell'
                    },
                    {
                        flex : 1,
                        html : '2.3',
                        cls  : 'cell'
                    }
                ]
            },
            {
                flex   : 2,
                layout : {
                    type  : 'hbox',
                    align : 'stretch'
                },
                items  : [
                    {
                        flex : 1,
                        html : '3.1',
                        cls  : 'cell'
                    },
                    {
                        flex : 1,
                        html : '3.2',
                        cls  : 'cell'
                    },
                    {
                        flex : 1,
                        html : '3.3',
                        cls  : 'cell'
                    }
                ]
            }
        ]
    });
    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.

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
  •