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
120
Deselect WebMenu Item
posted

Would like to know the best way to deselect a WebMenu item.

Scenario:

  • Users clicks "a" button on the screen
  • JavaScript unselects currently selected WebMenu item

I thought the following would work:

  1. var menu = $find("<%=WebDataMenu1.ClientID %>"); //Get Instance Of WebDataMenu           
  2. var selectedMenuItem = menu.get_selectedItem(); //Get Current Selected Web Menu Item
  3. selectedMenuItem.set_selected(false);

1 and 2 work, 3 does not work.

Any Suggestions.

  • 12679
    posted

    Hello Sal,

    Let me know if you have any questions with this matter.

    Thanks.

  • 12679
    Suggested Answer
    posted

    Hello Sal,

    Thanks for your post. Actually with the third point above from your post  you deselect the menu item but the Item remains Active and in that way the style used for Activation is the same like this one for selection. So, anyway you can overcome this in the following way :

     

       23 function webDataMenuDeselect() {

       24     var oMenu =

       25         $IG.WebDataMenu.find('<%=WebDataMenu1.ClientID%>')

       26     var selectedItem = oMenu.get_selectedItem();

       27     selectedItem.set_selected(false);

       28     oMenu._focusElement.focus();

       29     oMenu._focusElement.blur();

       30 }

    Thank you.