Results 1 to 2 of 2

Thread: add sub menu to this code

  1. #1
    Sencha User
    Join Date
    Oct 2016
    Posts
    1

    Default add sub menu to this code

    Hi, this is my first aproach with sencha touch, I have this code with a menu like FB, I want to add a sub menu item, I expect this behavior, when I touch in a menu a submenu is displayed.

    This is my app.js code:

    Code:
    Ext.define('Venta.view.Main', {
        extend: 'Ext.Container',
        xtype: 'main',
        requires: [
            'Ext.Menu'
        ],
        config: {
     
            layout: {
                type: 'card'
            },
     
            items: [
                {
                    xtype: 'toolbar',
                    docked: 'top',
                    title: 'Sistema de Control de Ventas',
                    items: [
                        {
                            xtype: 'button',
                            id: 'listButton',
                            iconCls: 'list',
                            ui: 'plain',
                            handler: function(){
                                if(Ext.Viewport.getMenus().left.isHidden()){
                                    Ext.Viewport.showMenu('left');
                                }
                                else
                                {
                                    Ext.Viewport.hideMenu('left');
                                }
                            }
                        }
                    ]
                }
            ]
        },
     
        initialize: function(){
            Ext.Viewport.setMenu(this.createMenu(),{
                side: 'left',
                reveal: true
            });
        },
     
        createMenu: function(){
    
    
    
    
    
    
            var menu = Ext.create('Ext.Menu', {
                width: 250,
                scrollable: 'vertical',
                items: [
                    {
                        xtype: 'button',
                        text: 'Vender',
                        handler: function(){
                            console.log("Option 1 Tapped");
                        }
                    },
                    {
                        xtype: 'button',
                        text: 'Configuracion',
                        leaf: true,
                        /*handler: function(){
                            console.log("Option 2 Tapped");
                        },*/
    //Here I tried put some items like submenu, but doesn't work
                                 items: [
                                {
                                    text: 'Form Panel',
                                    leaf: true,
                                    view: 'FormPanel',
                                    id: 'formpanel'
                                },
                                {
                                    text: 'Sliders',
                                    leaf: true,
                                    view: 'Sliders',
                                    id: 'sliders'
                                },
                                {
                                    text: 'Toolbar Inputs',
                                    leaf: true,
                                    view: 'ToolbarInput',
                                    id: 'toolbarinput'
                                }
                            ]
    
    
    
    
                        
    
    
                    }
                ]
            });
    
    
    
    
    
    
            return menu;
        }
    });
    What I doing wrong?

    Thanks in advance por any help.

    Regards
    Flavio

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    There isn't sub menu support in Touch as there is in Ext JS (menu config). Perhaps you could make use of a nested list.
    http://docs.sencha.com/touch/2.4/2.4...le/nested-list

Similar Threads

  1. [FIXED] [4.1.0 RC1] Menu onClick code fail :)
    By westy in forum Ext:Bugs
    Replies: 3
    Last Post: 13 Apr 2012, 12:41 AM
  2. Replies: 2
    Last Post: 16 Dec 2011, 1:15 AM
  3. Change the HTML code generated for a menu
    By cvs_fif in forum Ext GWT: Help & Discussion (1.x)
    Replies: 0
    Last Post: 5 Aug 2009, 7:47 AM

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
  •