Automatically close the menu on click

8 posts, 0 answers
  1. Luca B
    Luca B avatar
    41 posts
    Member since:
    Oct 2012

    Posted 17 Nov 2010 Link to this post

    Hi there,
    I have a RadMenu with several menu items. I want to automatically close the menu when the user clicks a menu item, regardless the level of the menu item itself.
    I have seen this post http://www.telerik.com/community/forums/aspnet-ajax/menu/closing-menu-in-onclientitemclicked-re-opens.aspx but it actually doesn't work: the menu is closed and then reopened. This is a serious issue for us when accessing our application on an iPad.
    Can you tell me how to achieve this?
    On a side note, why should I want a menu that stays open once I click on an item??? I am not able to think any use of this, nor I can think of an application that actually does this.
    Before you ask, yes, I am suggesting to at least have a property that handles this, without reverting to custom code :-)

    Luca
  2. Luca B
    Luca B avatar
    41 posts
    Member since:
    Oct 2012

    Posted 18 Nov 2010 Link to this post

    I don't understand, am I the only one who has this problem?
    I simply want the behavior I already see in a context menu: I click on an item, the related code is executed, the menu is closed.
    Any ideas?
  3. Rhyss
    Rhyss avatar
    60 posts
    Member since:
    Jan 2007

    Posted 19 Nov 2010 Link to this post

    I am having a similar issue regarding launching a radwindow from the clientside click of the menu item.  I have changed the z-index values so that the window will draw over the menu, but the menu will remain on top of the window until the mouse leaves the level of the menu item clicked.

    i hope there is a solution to this.
  4. Yana
    Admin
    Yana avatar
    5001 posts

    Posted 19 Nov 2010 Link to this post

    Hello there,

    Luka, 

    actually the context menu is supposed to close when an item is clicked, I cannot tell what is the reason for this issue in your case without sample code.

    Jordan,

    Have you checked this help article regarding z-index?

    Kind regards,
    Yana
    the Telerik team
    Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  5. Luca B
    Luca B avatar
    41 posts
    Member since:
    Oct 2012

    Posted 19 Nov 2010 Link to this post

    I will check the article, but my problem is related to menus, not context menus.
    I only wanted to point out the behavior I'd like to have for my menus, that is the one I see for context menus.

    Luca

    OK, I checked and I don't get how setting z-index could help me.
  6. Luca B
    Luca B avatar
    41 posts
    Member since:
    Oct 2012

    Posted 23 Nov 2010 Link to this post

    Hi again,
    is there anyone that can help me? I do not want to write tons of JS to fix something you probably can fix in a second.
    No one else has this problem?

    Thanks
  7. Luca B
    Luca B avatar
    41 posts
    Member since:
    Oct 2012

    Posted 01 Mar 2011 Link to this post

    Here I am again.
    I still have no solution for this problem. As you can see in the attached pictures, when I click a menu item (Customer Detail, in this case) the corresponding form is shown (in an IFRAME) but the menu remains open.
    I admit this is also the default behavior on regular browsers (not only on iPad), but on regular browsers I have the hover event that automatically closes the menu, while this event is unavailable on iPad.
    Can you please advice on this? I tried using the menuitem.close method, but the menu is first closed and the reopened.
    Thanks
    Luca
  8. Yana
    Admin
    Yana avatar
    5001 posts

    Posted 02 Mar 2011 Link to this post

    Hello Luca,

    I guess that you've set NavigateUrl and Target properties of the menu items - that's why you experience this behavior, is that the case? Could you please try to subscribe to OnClientItemClicked event of the menu and add the following code:

    <script type="text/javascript">
        function itemClicked(sender, args) {
            setTimeout(function() { args.get_item().close(); }, 100);
        }
    </script>

    Let us know how it goes.

    All the best,
    Yana
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top