jQuery UI Widgets Forums Navigation Menu, Context Menu Add Menu item and Subitem dynamically

This topic contains 4 replies, has 4 voices, and was last updated by  Amar Kansara 10 years, 3 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Add Menu item and Subitem dynamically #58890

    mangeshsingh
    Participant

    var data= [ {
    “id”: “101”,
    “parentid”: “100”,
    “text”: “Remove All”,
    “value”: “Remove All”
    },

    {
    “id”: “102”,
    “parentid”: “-1”,
    “text”: “Show/Hide Data window”,
    “value”: “SH”
    }
    ]

    I am creating context menu using above sample data.But i am unable to add/remove items at runtime.
    Please let me know how can i achieve this functionality.Please post a sample if possible.

    Add Menu item and Subitem dynamically #58917

    Mariya
    Participant

    Hi mangeshsingh,

    Unfortunately it is not possible to add or remove items in the context menu at runtime. If you have other questions do not hesitate to contact us, we would be happy to help you.

    Best Wishes,
    Mariya

    jQWidgets Team
    http://www.jqwidgets.com

    Add Menu item and Subitem dynamically #61172

    Bocho
    Participant

    you are planning these feature for the next version ?

    Add Menu item and Subitem dynamically #61873

    Bocho
    Participant

    if anyone interested, here is a code for dynamic menu :

    dynamic_menu(Array({id : “1.2.1”, nom : “item 1.2.1”},{id : “1.2.2”, nom : “item 1.2.2”}), Array({id : “2.2.1”, nom : “item 2.2.1”},{id : “2.2.2”, nom : “item 2.2.2”}));

    script Javascript

            function dynamic_menu(item12, item22){
                
                if($("#menu_top_contenu").length){
                    $("#menu_top_contenu").jqxMenu('destroy'); 
                }
                    
                var menu = "<div id='menu_top_contenu'>";
                menu    += "<ul>";
                menu    += "<li>item 1";
                menu    += "    <ul style='width: 250px;'>";
                menu    += "        <li><a href='#1.1'>item 1.1</a></li>";
                menu    += "        <li type='separator'></li>";
                menu    += "        <li>item 1.2";
                menu    += "            <ul id='menu_jarduino_list' style='width: 220px;'>";
                            $.each( item12, function( key, val ) {
                        menu    += "<li><a href='#"+ val.id +"'>"+ val.nom +"</a></li>";
                });            
                
                menu    += "            </ul>";
                menu    += "       </li>";
                menu    += "    </ul>";
                menu    += "</li>";
                menu    += "<li>item2\";
                menu    += "    <ul style='width: 250px;'>";
                menu    += "        <li><a href='#2.1'>Item 2.1</a></li>";
                menu    += "           <ul style='width: 220px;'>";
                            $.each( item22, function( key, val ) {
                        menu    += \"<li><a href='#"+ val.id +"'>"+ val.nom +"</a></li>";
                });
                
                menu    += "            </ul>";
                menu    += "        </li>";
                menu    += "    </ul>";
                menu    += "</li>";
                menu    += "</ul>";
                menu    += "</div>";
                           
                $("#menu_top").append(menu);
                $("#menu_top_contenu").jqxMenu({ width: '90%', height: '30px' });
            
            
            }

    balise Html

    
        <div id='menu_top'>
        </div>
    Add Menu item and Subitem dynamically #62001

    Amar Kansara
    Participant

    Hello Mangeshsingh,

    I guess here is what you are looking for and it might help you out..

    https://onedrive.live.com/redir?resid=87158B565031B24B%21152

    Hopefully it will let you download the project. Otherwise please write me on amar.kansara@gmail.com

    Amar

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.