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

Possible to attach context menu to grid rows but not to contained links?

4 Answers 292 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Uwe
Top achievements
Rank 1
Uwe asked on 19 Oct 2015, 09:19 PM

What I'm successfully doing is to attach a ContextMenu to a Grid:

@(Html.Kendo().ContextMenu()
  .Name(@"menu")
  .Target(@"#grid")
  .Filter(@"tbody tr td")
  .Orientation(ContextMenuOrientation.Vertical)
  .Animation(false)
  .Events(evt => evt.Select(@"contextMenuItemSelect").Open(@"contextMenuOpen"))
  .Items(
      items =>
      {
      items.Add().Text(​"Rename");
      items.Add().Text("Delete");
      })
)

This works just as expected.

Now what I'm trying to do is to allow my Kendo context menu when clicking on a cell but show the browser's built-in menu when clicking on a link inside a cell. (See attached image)

I've tried various filters like .Filter(@"tbody tr td :not(a)") but this only results in a completely no-appearing context menu.

My question:

Is it possible to somehow achieve what I want?

4 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 22 Oct 2015, 07:58 AM

Hello Uwe,

There is no viable solution that we could suggest for the current scenario. A possible workaround would be to add a CSS class to the cell containing the link and exclude it in the Context Menu filter configuration via jQuery's not selector. This way the context menu will not be shown for the whole cell, containing the link.
E.g.

.Target("#grid")
.Filter("tbody tr td:not(.linkCell)")

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Uwe
Top achievements
Rank 1
answered on 22 Oct 2015, 08:37 AM
Thanks for your help, Dimiter.
0
Arpit
Top achievements
Rank 1
answered on 06 Jan 2016, 06:34 AM

i have a grid and i want to attach context menu to the last cell of a row on left click of mouse.

How to achieve this?

0
Dimiter Madjarov
Telerik team
answered on 07 Jan 2016, 03:00 PM

Hello Arpit,

By design the context menu is only opened on right click. In order to implement the current scenario, you could manually force the context menu to open by using it's open method. The open method accepts as parameters the coordinates where it should be opened.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Menu
Asked by
Uwe
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Uwe
Top achievements
Rank 1
Arpit
Top achievements
Rank 1
Share this question
or