Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
75
setEnabled(True) - Submenu will not re-enable itself
posted

I have v2004

if(button == 2){
    var itemRedShirts = getItemFromTag("RedShirts", items);

       if {ShirtColor== 'Red'){
             if (itemRedShirts !=null)itemRedShirts .setEnabled(false);
       }else{
            if (itemRedShirts !=null)itemRedShirts .setEnabled(true);
       }
}

 igtree_getNodeById(nodeId).setSelected(true);
igmenu_showMenu('popTreeMenu', tree.event);
return true:

function igmenu_setEnabled(enabled) {
if(this.element != null{
     v
ar e = igmenu_getItemTdTag(this.element);
     
if(enabled == true) {
          
e.removeAttribute("igDisabled");
          
var oldClass=e.getAttribute("oldEnabledClass");
           e.className=oldClass;
           e.removeAttribute("oldEnabledClass");
       }
   
else {
         
var ms = igmenu_getMenuById(this.getMenuId());
         
var disabledClass = ms.DisabledClass;
         
this.element.setAttribute("igDisabled", "1");
         
var oldClass = e.className;
      }
   }
}

 

 

When I right click on my tree, I want certain menus to be disabled.  They then will need to be re-enabled when I select a different item.  Sounds easy enough right?

When I re-enable the menu option it isn't gray anymore, but it wont allow me to select it.  Acts like it is disabled still.

Anyone have any ideas what I am doing wrong here?  I must be missing a small piece to this.

Thanks.

 

 

  • 28407
    posted

    HI,

     If you are using version 2004 you should consider upgrading to a new version -  because that version is outside of the support range.

    I was able to enable a menu item and re-enable it on the client-side.

     Here is my page: I tested this and it worked.

    <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

    <%@ Register assembly="Infragistics2.WebUI.UltraWebNavigator.v9.1, Version=9.1.20091.2015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.WebUI.UltraWebNavigator" tagprefix="ignav" %>

    <!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>Untitled Page</title>
    <style type="text/css">
                    body,html,form
                    {
                                    height:100%;
                    }
    </style>

        <script type="text/javascript" id="Infragistics">
    <!--

    <!--

    function UltraWebTree1_NodeClick(treeId, nodeId, button){
     //Add code to handle your event here.
     
     var tree = igtree_getTreeById(treeId);
     var node = tree.getNodeById(nodeId)
     var level = node.getLevel();
     var items = new Array();
     items = menu.getItems();
     if (level == 0)
     {
       items[0].setEnabled(false);
     }
     else
     {
     items[0].setEnabled(true);
     }
     igmenu_showMenu("UltraWebMenu1", event)

    }
    // -->
    var menu = null;
    function UltraWebMenu1_InitializeMenu(menuId){
     //Add code to handle your event here.
     menu = igmenu_getMenuById(menuId)
        var items = new Array();
       
    }
    // -->
    </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
       
            <ignav:UltraWebTree ID="UltraWebTree1" runat="server" DefaultImage=""
                HiliteClass="" HoverClass="" Indentation="20">
                <ClientSideEvents NodeClick="UltraWebTree1_NodeClick" />
                <Levels>
                    <ignav:Level Index="0" />
                </Levels>
                <Nodes>
                    <ignav:Node Text="Root Node">
                        <Nodes>
                            <ignav:Node Text="Child Node">
                            </ignav:Node>
                            <ignav:Node Text="Child Node">
                            </ignav:Node>
                            <ignav:Node Text="Child Node">
                            </ignav:Node>
                        </Nodes>
                    </ignav:Node>
                    <ignav:Node Text="Root Node">
                        <Nodes>
                            <ignav:Node Text="Child Node">
                            </ignav:Node>
                            <ignav:Node Text="Child Node">
                            </ignav:Node>
                            <ignav:Node Text="Child Node">
                            </ignav:Node>
                        </Nodes>
                    </ignav:Node>
                </Nodes>
            </ignav:UltraWebTree>
       
        </div>
        <ignav:UltraWebMenu ID="UltraWebMenu1" runat="server" WebMenuTarget="PopupMenu">
            <IslandStyle BackColor="LightGray" BorderStyle="Outset" BorderWidth="1px"
                Cursor="Default">
            </IslandStyle>
            <HoverItemStyle BackColor="DarkBlue" Cursor="Default" ForeColor="White">
            </HoverItemStyle>
            <Images>
                <SubMenuImage Url="ig_menuTri.gif" />
            </Images>
            <ItemStyle Cursor="Default" />
            <Items>
                <ignav:Item Text="Top Item 1">
                </ignav:Item>
                <ignav:Item Text="Top Item 2">
                </ignav:Item>
                <ignav:Item Text="Top Item 3">
                </ignav:Item>
                <ignav:Item Text="Top Item 4">
                </ignav:Item>
            </Items>
            <DisabledStyle Font-Names="MS Sans Serif" Font-Size="8pt" ForeColor="Gray">
            </DisabledStyle>
            <Levels>
                <ignav:Level Index="0" />
            </Levels>
            <SeparatorStyle BackgroundImage="ig_menuSep.gif" CssClass="SeparatorClass"
                CustomRules="background-repeat:repeat-x; " />
    <ExpandEffects ShadowColor="LightGray"></ExpandEffects>
            <MenuClientSideEvents InitializeMenu="UltraWebMenu1_InitializeMenu" />
        </ignav:UltraWebMenu>
        </form>
    </body>
    </html>