Results 1 to 2 of 2

Thread: object object object has no method 'onadded' when trying to add items to menu list

  1. #1
    Sencha User
    Join Date
    Jun 2008
    Location
    London
    Posts
    18

    Default object object object has no method 'onadded' when trying to add items to menu list

    Hi All

    I am trying to create a sub menu list for a menu componet dynamically.

    Code:
    //first i am creating the main menu...
    toolsMenuItem = Ext.create("Ext.menu.Item", {
    					text : 'mainmenu',
    				        menu : [subMenuItems]
    });
    // later then creating the submenu
    var SubMenuItem =Ext.create("Ext.menu.Item", {
    text : 'submenu1'
    });
    
    Ext.getCmp('menutoolbar').add(toolsMenuItem );
    the main menu is getting added but the submenu is giving me a error as
    Uncaught TypeError: Object [object Object],[object Object],[object Object],[object Object] has no method 'onAdded'

    can anyone please help me out to fix this .


    Thanks
    Abhigudi

  2. #2
    Sencha User
    Join Date
    Jun 2014
    Posts
    8

    Default

    Check this code :

    Code:
    Ext.create('Ext.menu.Menu', {
                width: 150,
                margin: '0 0 10 0',
                floating: false,  // usually you want this set to True (default)
                renderTo: Ext.getBody(),  // usually rendered by it's containing component
                items: [{
                    text: 'Main Menu1',
                    menu : {
                        items : [{
                            text : 'Sub Menu1'
                        }]
                    }
                },{
                    text: 'Main Menu2'
                },{
                    text: 'Main Menu3'
                }]
            });

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
  •