Is it possible to add menu items to a sub-menu on-demand?

Page 1 of 2 12 LastLast
  1. #1

    Is it possible to add menu items to a sub-menu on-demand?

    Hi guys, I was looking for this really sleek functionality, load menu items when you hover your mouse over the sub-menu, I have a GridPanel with a command column, inside this command column I added a SplitCommand which contains a Menu that has several MenuCommands and one of these MenuCommands has inner MenuCommands, these I would like to load from the database when the user moves the mouse over this menu item based on the underlining row id of the GridPanel, is this possible?
    Thanks,
    Paul

    <ext:CommandColumn Header="Actions" Width="85">
                            <Commands>
                                <ext:SplitCommand Icon="MoneyAdd" CommandName="PaymentMenu" Text="Payment" ToolTip-Text="Payment">
                                    <Menu EnableScrolling="false">
                                        <Items>
                                            <ext:MenuCommand Text="Payment History" Icon="Note" CommandName="PaymentHistory" />
                                            <ext:MenuCommand Text="Payment Templates" Icon="ArrowRight">                                            
                                                <Menu EnableScrolling="false">
                                                    <Items>
                                                        <ext:MenuCommand Text="01-01-2010 - $125,45" Icon="MoneyAdd" CommandName="Item" />        
                                                        <ext:MenuCommand Text="04-01-2009 - $433,35" Icon="MoneyAdd" CommandName="Item" />
                                                        <ext:MenuCommand Text="....." Icon="..." CommandName="..." />
                                                    </Items>                                                
                                                </Menu>
                                            </ext:MenuCommand>                                        
                                        </Items>
                                    </Menu>                                
                                </ext:SplitCommand>
                            </Commands>
                        </ext:CommandColumn>
  2. #2
    Try this. I played with this a while ago, but on the desktop menu. Maybe it will work for your purpose also.

    Dim SubMenu As Coolite.Ext.Web.Menu = New Coolite.Ext.Web.Menu()
    Dim SubMenuFolder As Coolite.Ext.Web.MenuItem
    SubMenu.ID = "SubMenu"
    MainMenu.Menu.Add(SubMenu)
    SubMenuFolder = New Coolite.Ext.Web.MenuItem()
    SubMenuFolder.ID = "idmenu"
    SubMenuFolder.Icon = Icon.Information
    SubMenuFolder.Text = "Menu Name"
    SubMenu.Items.Add(SubMenuFolder)
    Sorry but this is in VB.

    Richardt
    Last edited by geoffrey.mcgill; Aug 20, 2010 at 2:28 PM.
  3. #3
    Quote Originally Posted by Richardt View Post
    Try this. I played with this a while ago, but on the desktop menu. Maybe it will work for your purpose also.


    Dim SubMenu As Coolite.Ext.Web.Menu = New Coolite.Ext.Web.Menu()
    Dim SubMenuFolder As Coolite.Ext.Web.MenuItem
    SubMenu.ID = "SubMenu"
    MainMenu.Menu.Add(SubMenu)
    SubMenuFolder = New Coolite.Ext.Web.MenuItem()
    SubMenuFolder.ID = "idmenu"
    SubMenuFolder.Icon = Icon.Information
    SubMenuFolder.Text = "Menu Name"
    SubMenu.Items.Add(SubMenuFolder)

    Sorry but this is in VB.

    Richardt
    Hi Richardt, that seems to work but how can I have it to be triggered only you move the mouse over the parent menu item? (load on-demand)
    Thanks,
    Paul
  4. #4
    On the menu can't you just use an ajaxevent and the mouseover function to call a function on the serverside like below.

    <AjaxEvents><MouseOver OnEvent="loads"></MouseOver>
     
    <Coolite.Ext.Web.AjaxMethod()> _
    Public Sub loads()
    End Sub
    Last edited by geoffrey.mcgill; Aug 20, 2010 at 2:28 PM.
  5. #5
    Quote Originally Posted by Richardt View Post
    On the menu can't you just use an ajaxevent and the mouseover function to call a function on the serverside like below.

    <AjaxEvents><MouseOverOnEvent="loads"></MouseOver>
     
    <Coolite.Ext.Web.AjaxMethod()> _
    PublicSub loads()
    EndSub
    That seems like the way to go but where/how to use that AjaxEvent? Isn't it DirectMethod now on 1.0?
    See my component structure and please point where to use it:

    <ext:SplitCommand Icon="MoneyAdd" CommandName="PaymentMenu" Text="Payment" ToolTip-Text="Payment">                                <Menu EnableScrolling="false">
                                        <Items>
                                            <ext:MenuCommand Text="Payment History" Icon="Note" CommandName="PaymentHistory" />
                                            <ext:MenuCommand Text="Payment Templates" Icon="ArrowRight">                                            
                                                <Menu EnableScrolling="false">
                                                    <Items>
    
    These items should  load from the database when you hover "Payment Templates"
                                                        <ext:MenuCommand Text="01-01-2010 - $125,45" Icon="MoneyAdd" CommandName="Item" />        
                                                        <ext:MenuCommand Text="04-01-2009 - $433,35" Icon="MoneyAdd" CommandName="Item" />
    
                                                        <ext:MenuCommand Text="....." Icon="..." CommandName="..." />
                                                    </Items>                                                
                                                </Menu>
                                            </ext:MenuCommand>                                        
                                        </Items>
                                    </Menu>                                
                                </ext:SplitCommand>
  6. #6
    Do you guys know if it is possible to load sub-menu items on demand with a DirectEvent or anything like that since I can't add events to the menu?
    Thanks,
    Paul
    Attached Thumbnails Click image for larger version. 

Name:	shot.jpg 
Views:	154 
Size:	41.2 KB 
ID:	1541  
    Last edited by paul-2011; Aug 30, 2010 at 2:37 PM. Reason: Added attachment
  7. #7
    Quote Originally Posted by Richardt View Post
    On the menu can't you just use an ajaxevent and the mouseover function to call a function on the serverside like below.

    <AjaxEvents><MouseOverOnEvent="loads"></MouseOver>
     
    <Coolite.Ext.Web.AjaxMethod()> _
    PublicSub loads()
    EndSub
    I wish but where/how? I can't find those events.
  8. #8
    There is a sample on adding the menu items on PageLoad, but not on-demand.

    protected void Page_Load(object sender, EventArgs e)
            {
                Ext.Net.MenuItem item = new Ext.Net.MenuItem();
                item.Text = "Dynamically added Item";
                item.Handler = "onItemClick";
                MenuButton.Menu.Primary.Items.Add(item);
    
                item = new Ext.Net.MenuItem();
                item.Text = "Disabled Item";
                item.Disabled = true;
                MenuButton.Menu.Primary.Items.Add(item);
    
                Ext.Net.Menu scrollingMenu = new Ext.Net.Menu{ MaxHeight = 250, EnableScrolling = true};
                for (int i = 0; i < 50; i++)
                {
                    scrollingMenu.Items.Add(new Ext.Net.MenuItem{Text="Item "+(i+1)});
                }
                ScrollingMenuButton.Menu.Add(scrollingMenu);
            }
  9. #9
    Btw, the event is on the documentation but I don't know how/where to use it (see attachment)
    Attached Thumbnails Click image for larger version. 

Name:	shot.jpg 
Views:	132 
Size:	8.9 KB 
ID:	1542  
  10. #10
    One last attachment to illustrate.

    The approach used on http://forums.ext.net/showthread.php...=menu+listener wouldn't work for me because I use a split button, or is there a work around?
    Thanks,
    Paul
    Attached Thumbnails Click image for larger version. 

Name:	shot.jpg 
Views:	141 
Size:	49.1 KB 
ID:	1544  
    Last edited by paul-2011; Aug 30, 2010 at 2:57 PM.
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 0
    Last Post: Aug 09, 2012, 5:37 AM
  2. Replies: 2
    Last Post: Apr 02, 2012, 7:48 AM
  3. Add items to menu dynamically
    By sunshine in forum 1.x Help
    Replies: 5
    Last Post: Mar 10, 2011, 6:44 PM
  4. [CLOSED] [1.0] GridPanel Group Command (Menu Type ) show/hide on demand
    By webclouder in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 10, 2010, 5:04 PM
  5. [CLOSED] [1.0] MVC sample west menu has no menu items
    By Inoventus in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Nov 24, 2009, 4:06 AM

Posting Permissions