Welcome Guest Search | Active Topics | Sign In | Register

Javascript syntax to disable a submenu item Options
Darrell Reinke
Posted: Tuesday, December 1, 2009 11:30:41 AM
Rank: Advanced Member
Groups: Member

Joined: 7/18/2008
Posts: 76
Good Morning,

I am trying to disable a submenu item via javascript and have not been able to reference the submenu item via javascript. I am able to disable a top level menu item. Below is the current javascript syntax and menu item I am using. Any help would be greatly appreciated.

To keep it simple, I only included the menu object, as you can see I am disabling other EO objects successfully, just not the submenu item.

This syntax will disable the top level menu item (Class Schedule Tasks), however, I want to keep that enabled and disable submen item "Add New Schedule":
Code: JavaScript
var mnuClassObj = eo_GetObject("<%=mnuClass.ClientID %>");
mnuClassObj.getTopGroup().getItemByIndex(2).setDisabled(false);


Any help would be greatly appreciated.

Code: JavaScript
function setTabStripVisible(){
      
         var tbTargetsObj = eo_GetObject("<%=tbTargets.ClientID %>");
         var mnuClassObj = eo_GetObject("<%=mnuClass.ClientID %>");
         var mpTargets = eo_GetObject("<%=mpTargets.ClientID %>");
         var cbxWebExObj = document.getElementById("<%=cbxWebEx.ClientID %>");
         var cbxGSOObj = document.getElementById("<%=cbxGreystarOnline.ClientID %>");

         if (cbxWebExObj.checked || cbxGSOObj.checked) {
            tbTargetsObj.getTopGroup().getItemByIndex(0).setVisible(false);
            mpTargets.selectPageByIndex(0);
            tbTargetsObj.getTopGroup().getItemByIndex(1).setSelected(true); 
            mnuClassObj.getTopGroup().getItemByIndex(2).setDisabled(true);           
         }
         else {
           tbTargetsObj.getTopGroup().getItemByIndex(0).setVisible(true);
           tbTargetsObj.getTopGroup().getItemByIndex(0).setSelected(true);
           mpTargets.selectPageById("<%=pvSchedule.ClientID %>");
           mnuClassObj.getTopGroup().getItemByIndex(2).setDisabled(false);
         } //End if (cbxWebEx.checked || cbxGSO.checked) {
     
      } //End function setTabStripVisible(){


Code: HTML/ASPX
<eo:Menu ID="mnuClass" runat="server" CheckIconUrl="OfficeCheckIcon2" ControlSkinID="None"
                              Width="99%">
                              <LookItems>
                                 <eo:MenuItem DisabledStyle-CssText="background-color:transparent;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;padding-bottom:1px;padding-left:5px;padding-right:5px;padding-top:1px;color:gray"
                                    Height="24" HoverStyle-CssText="background-color:#C0D6F4;border-bottom-color:#000080;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#000080;border-left-style:solid;border-left-width:1px;border-right-color:#000080;border-right-style:solid;border-right-width:1px;border-top-color:#000080;border-top-style:solid;border-top-width:1px;padding-left:4px;padding-right:4px;padding-top:0px;padding-bottom:0px;"
                                    ItemID="_TopLevelItem" NormalStyle-CssText="background-color:transparent;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;padding-bottom:1px;padding-left:5px;padding-right:5px;padding-top:1px;"
                                    SelectedStyle-CssText="background-color:white;border-bottom-color:#000080;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#000080;border-left-style:solid;border-left-width:1px;border-right-color:#000080;border-right-style:solid;border-right-width:1px;border-top-color:#000080;border-top-style:solid;border-top-width:1px;padding-left:4px;padding-right:4px;padding-top:0px;padding-bottom:0px;">
                                    <SubMenu CollapseEffect-Type="GlideTopToBottom" ExpandEffect-Type="GlideTopToBottom"
                                       ItemSpacing="3" LeftIconCellWidth="25" SideImage="Office2003SideBar2" Style-CssText="background-color:#F6F6F6;border-bottom-color:#002D96;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#002D96;border-left-style:solid;border-left-width:1px;border-right-color:#002D96;border-right-style:solid;border-right-width:1px;border-top-color:#002D96;border-top-style:solid;border-top-width:1px;color:black;cursor:hand;font-family:Tahoma;font-size:8pt;padding-bottom:1px;padding-left:1px;padding-right:1px;padding-top:1px;">
                                    </SubMenu>
                                 </eo:MenuItem>
                                 <eo:MenuItem IsSeparator="True" ItemID="_Separator" NormalStyle-CssText="background-color:#6a8ccb;height:1px;margin-left:30px;width:1px;">
                                 </eo:MenuItem>
                                 <eo:MenuItem DisabledStyle-CssText="background-color:transparent;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;padding-bottom:1px;padding-left:2px;padding-right:5px;padding-top:1px;color:gray"
                                    Height="24" HoverStyle-CssText="background-color:#FFEEC2;border-bottom-color:#000080;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#000080;border-left-style:solid;border-left-width:1px;border-right-color:#000080;border-right-style:solid;border-right-width:1px;border-top-color:#000080;border-top-style:solid;border-top-width:1px;padding-left:1px;padding-right:4px;padding-top:0px;"
                                    ItemID="_Default" NormalStyle-CssText="background-color:transparent;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;padding-bottom:1px;padding-left:2px;padding-right:5px;padding-top:1px;"
                                    SelectedStyle-CssText="background-color:white;border-bottom-color:#000080;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#000080;border-left-style:solid;border-left-width:1px;border-right-color:#000080;border-right-style:solid;border-right-width:1px;border-top-color:#000080;border-top-style:solid;border-top-width:1px;padding-left:1px;padding-right:4px;padding-top:0px;"
                                    Text-Padding-Right="30">
                                    <SubMenu CollapseEffect-Type="GlideTopToBottom" ExpandEffect-Type="GlideTopToBottom"
                                       ItemSpacing="3" LeftIconCellWidth="25" SideImage="Office2003SideBar2" Style-CssText="background-color:#F6F6F6;border-bottom-color:#002D96;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#002D96;border-left-style:solid;border-left-width:1px;border-right-color:#002D96;border-right-style:solid;border-right-width:1px;border-top-color:#002D96;border-top-style:solid;border-top-width:1px;color:black;cursor:hand;font-family:Tahoma;font-size:8pt;padding-bottom:1px;padding-left:1px;padding-right:1px;padding-top:1px;">
                                    </SubMenu>
                                 </eo:MenuItem>
                              </LookItems>
                              <TopGroup Style-CssText="background-color:#6f99c2;">
                                 <Items>
                                    <eo:MenuItem LeftIcon-Url="~/Images/classroom_save_24.gif" Text-Html="Save" OnClickScript="saveClassInfo()">
                                    </eo:MenuItem>
                                    <eo:MenuItem OnClickScript="searchClass('SEARCH')" Text-Html="Find Class" LeftIcon-Url="~/Images/classroom_search_24.gif">
                                    </eo:MenuItem>
                                    <eo:MenuItem LeftIcon-Url="~/Images/classroom_config_24.gif" Text-Html="Class Tasks">
                                       <SubMenu>
                                          <Items>
                                             <eo:MenuItem LeftIcon-Url="~/Images/classroom_add_16.gif" Text-Html="Add New Class"
                                                ToolTip="Add a new class." OnClickScript="classTask('ADDCLASS', '')">
                                             </eo:MenuItem>
                                             <eo:MenuItem LeftIcon-Url="~/Images/schedule_add_16.gif" Text-Html="Add Schedule"
                                                ToolTip="Add a new schedule to the class." RightIcon-Url="" OnClickScript="classTask('ADDSCHED', '')">
                                             </eo:MenuItem>
                                             <eo:MenuItem Text-Html="Remove Class" ToolTip="BE CAREFUL!!!  This task should only be performed if you are certain this class information/schedules is no longer needed."
                                                LeftIcon-Url="~/Images/classroom_close_16.gif" OnClickScript="classTask('REMOVECLASS', '')">
                                             </eo:MenuItem>
                                          </Items>
                                       </SubMenu>
                                    </eo:MenuItem>
                                    <eo:MenuItem LeftIcon-Url="~/Images/mini_sites_24.gif" Text-Html="Screens">
                                       <SubMenu>
                                          <Items>
                                             <eo:MenuItem LeftIcon-Url="~/Images/classroom_reload_16.gif" Text-Html="Manage Class Prerequisites"
                                                
                                                ToolTip="Setup classes that must be completed before scheduling this class." 
                                                OnClickScript="javascript:manageClass('PREREQ');">
                                             </eo:MenuItem>
                                             <eo:MenuItem LeftIcon-Url="~/Images/customers_16.gif" 
                                                Text-Html="Manage Target Audience" 
                                                OnClickScript="javascript:manageClass('TARGET');">
                                             </eo:MenuItem>
                                          </Items>
                                       </SubMenu>
                                    </eo:MenuItem>
                                    <eo:MenuItem Text-Html="Help">
                                       <SubMenu>
                                          <Items>
                                             <eo:MenuItem Text-Html="About" OnClickScript="eo_GetObject('dlgAbout').show(); ">
                                             </eo:MenuItem>
                                          </Items>
                                       </SubMenu>
                                    </eo:MenuItem>
                                    <eo:MenuItem CustomItemID="ciStatus" Text-Html="&nbsp;&nbsp;&nbsp;" Visible="false">
                                    </eo:MenuItem>
                                 </Items>
                              </TopGroup>
                           </eo:Menu>
                           <eo:CustomItem ID="ciStatus" runat="server" Width="200px">
                              <asp:Label ID="lblStatus" runat="server" Font-Bold="True" Font-Names="Calibri" Font-Size="Small"
                                 ForeColor="White" Height="24"></asp:Label>
                           </eo:CustomItem>
eo_support
Posted: Tuesday, December 1, 2009 11:33:56 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

It's similar. Except that you will need to do something like this:

mnuClassObj.getTopGroup().getItemByIndex(2).getSubGroup().getItemByIndex(index).setDisabled(true);

You basically just keep calling getTopGroup/getSubGroup and getItemByIndex until you reach your target item.

Thanks
Darrell Reinke
Posted: Tuesday, December 1, 2009 11:39:59 AM
Rank: Advanced Member
Groups: Member

Joined: 7/18/2008
Posts: 76
Thank you,

That syntax is exactly what I was needing.

I should have researched a little more before submitting. I was really close to figuring this out before posting the question. Guess I am getting lazy....


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.