This is a migrated thread and some comments may be shown as answers.

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

4 Answers 168 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 20 Aug 2010, 07:47 PM
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

4 Answers, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 20 Aug 2010, 08:12 PM
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.
0
Cori
Top achievements
Rank 2
answered on 20 Aug 2010, 08:19 PM
You'll need to add it to the RadGrid's ClientSettings->ClientEvents->OnColumnClick event.

Forgot to mention that in my previous post.
0
Dan
Top achievements
Rank 1
answered on 26 Aug 2010, 09:51 PM
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
0
David
Top achievements
Rank 1
answered on 03 Apr 2013, 07:16 PM
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?  
Tags
Grid
Asked by
Dan
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
Dan
Top achievements
Rank 1
David
Top achievements
Rank 1
Share this question
or