[CLOSED] dynamically modifying submenu items on the client side

  1. #1

    [CLOSED] dynamically modifying submenu items on the client side

    Hi,
    We are using ext:Menu where some MenuItems has it's own menu. Some MenuItems on that child menu should be hidden/disabled depending on current node of the parent control (TreePanel). We tried to approach this by adding <Listeners> to first level MenuItem, but there is no OnHover event available there. That event certainly handled by ext.net as SubMenu2 shows while hovering on parent MenuItem1 in the example below, it just not available for us I assume. We tried to use Click event; while it does the job it's too late - SubMenu2 items already rendered before user click on MenuItem1.

    How we should handle this situation of dynamically modifying submenu items on the client side?

    <ext:Menu ID="Menu1" runat="server">
                 <Items>
                        <ext:MenuItem ID="MenuItem1" runat="server" Text="Menu1">
                        <Listeners >
                        <%--  need something like this
                          <OnHover Handler ="buildSubMenu()" />
                        --%>
                        </Listeners>
                            <Menu>
                                <ext:Menu ID="SubMenu2" runat="server">
                                    <Items>
                                        <ext:MenuItem ID="Item1" runat="server" Text="Item1" />
                                        <ext:MenuItem ID="Item2" runat="server" Text="Item2" />
                                    </Items>
                                </ext:Menu>
                            </Menu>
                        </ext:MenuItem>
                        <ext:MenuItem ID="MenuItem2" runat="server" Text="Menu2">
                        </ext:MenuItem>
                    </Items>
                </ext:Menu>
    Last edited by Daniil; Jul 06, 2011 at 10:48 PM. Reason: Please use [CODE] tags, [CLOSED]
  2. #2
    Hi,

    Please see the example how to handle the "mouseover" event.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:Menu runat="server" Floating="false" Width="300">
                <Items>
                    <ext:MenuItem Text="Item 1">
                        <Listeners>
                            <Render Handler="this.el.on('mouseover', function () { alert('mouseover'); })" />
                        </Listeners>
                    </ext:MenuItem>
                    <ext:MenuItem Text="Item 2">
                        <Listeners>
                            <Render Handler="this.el.on('mouseover', function () { alert('mouseover'); })" />
                        </Listeners>
                    </ext:MenuItem>
                </Items>
            </ext:Menu>
        </form>
    </body>
    </html>
    See also Examples Explorer -> Toolbar -> Menu examples.
  3. #3
    That seems to work. Thanks very much!

Similar Threads

  1. Replies: 3
    Last Post: Dec 26, 2011, 1:32 PM
  2. [CLOSED] Add items to RadioGroup from client side
    By softmachine2011 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 09, 2011, 12:58 PM
  3. Replies: 1
    Last Post: Dec 01, 2010, 5:14 PM
  4. Replies: 4
    Last Post: Mar 19, 2010, 11:35 AM
  5. Replies: 0
    Last Post: Sep 17, 2009, 8:04 AM

Tags for this Thread

Posting Permissions