Dynamic Menu Creation

  1. #1

    Dynamic Menu Creation

    Hello,
    I have the following static code to create a Menu but would like to populate it from a string array or a list of data such as string [ ] { "Menu1" , "Menu2" , "Menu3" }. Thanks ...

    X.Panel ( )
    .Title ( "Item 3: 100% 50%" )
    .AnchorHorizontal ( "100%" )
    .AnchorVertical ( "50%" )
    .Items( X.Menu ( )
    .TitleAlign(TitleAlign.Right)
    .Defaults(new { MenuAlign = "tl-bl?" } )
    .Floating ( false )
    .Layout (LayoutType.HBox)
    .ShowSeparator ( false )
    .Items(
    X.ToolbarFill(),
    X.MenuItem()
    .Text("Web Access Links")
    .Menu(
    X.Menu()
    .Items
    (

    X.MenuItem()
    .Text("HI there"),
    X.MenuItem()
    .Text("HI there2")
    )
    ),
    X.MenuItem()) )
  2. #2
    Hello!

    Can you wrap your code in CODE tag, paragraph 3 here: http://forums.ext.net/showthread.php?3440

    If you want to change menu items you should use add and remove methods:
    http://docs.sencha.com/extjs/4.2.1/#...enu-method-add
    http://docs.sencha.com/extjs/4.2.1/#...-method-remove

    If you want to create new menu with required values you should use create:

    var menuItems = [];
    
    //Add items here like below:
    // menuItems .push({text: 'myItem'});
    
    Ext.create('Ext.menu.Menu', {
        items: menuItems
    });

Similar Threads

  1. [CLOSED] Dynamic menu items in menu panel creation problem
    By legaldiscovery in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 10, 2013, 10:29 AM
  2. [CLOSED] Dynamic Panel Creation
    By state in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 21, 2009, 2:19 PM
  3. Dynamic Portal Creation
    By iansriley in forum 1.x Legacy Premium Help
    Replies: 0
    Last Post: Jan 21, 2009, 5:53 PM
  4. Problem with dynamic controls creation
    By afhi in forum 1.x Help
    Replies: 1
    Last Post: Dec 19, 2008, 5:31 PM
  5. Dynamic Creation Of Controls
    By Steve in forum 1.x Help
    Replies: 4
    Last Post: Dec 01, 2008, 5:46 PM

Tags for this Thread

Posting Permissions