How to show the radgrid context menu on left click instead of right click.

5 posts, 0 answers
  1. Dan
    Dan avatar
    2 posts
    Member since:
    Aug 2010

    Posted 20 Aug 2010 Link to this post

    Hi,

    Can you please tell me how I can get the headercontextmenu to show up when a user left clicks on a column's header, instead of the usual showing up on right click only?

    Currently, left-clicking sorts the column by default. However, since the context menu (that shows up when you right click the header) includes options for sorting ascending or descending, as well as grouping/filtering, etc, we would like the left click to show the context menu.

    Is there a mouseclick event I would need to capture or something? Any help is greatly appreciated!

    Thanks

    Dan
  2. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 20 Aug 2010 Link to this post

    Hello Dan,

    Try this:

    function OnColumnClick(sender, args){
       args.get_gridColumn().showHeaderMenu(args.domEvent);
    }

    I don't know about the event parameter, but in the documentation it shows it as a required field so I just passed the domEvent.

    I hope that helps.
  3. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 20 Aug 2010 Link to this post

    You'll need to add it to the RadGrid's ClientSettings->ClientEvents->OnColumnClick event.

    Forgot to mention that in my previous post.
  4. Dan
    Dan avatar
    2 posts
    Member since:
    Aug 2010

    Posted 26 Aug 2010 Link to this post

    Thanks Cori!

    That worked great :-)

    Now I just gotta tweak my other client side code to play nice with this new bit...were there some changes to the tricks needed for paring down the list of items that show up in the headercontextmenu in the q2 2010 release?

    Dan
  5. David
    David avatar
    10 posts
    Member since:
    Oct 2010

    Posted 03 Apr 2013 Link to this post

    Hi.  I'm trying to use this technique to display the context menu on left click instead of right using the same JS function listed earlier in this admittedly older article, and it sort of works, but when I click, the menu appears "opened" and then quickly rolls itself back up.  

    Note that the menu appears correctly on right-click, so this isn't a generalized problem with the menu; it's just with the left-click call via showHeaderMenu.

    Any thoughts?  
Back to Top