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

kendo grid row right click context menu

2 Answers 1325 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anamika
Top achievements
Rank 1
Anamika asked on 01 Oct 2014, 02:58 PM
Hello,

I was going through the context menu example
http://demos.telerik.com/aspnet-mvc/menu/context-menu

and i would like to show context menu on kendo grid instead. So on view where i have kendo grid i am adding the following code
@(Html.Kendo().ContextMenu()
        .Name("menu")
        .Target("#Grid")
        .Orientation(ContextMenuOrientation.Vertical)
        .Animation(animation =>
        {
            animation.Open(open =>
            {
                open.Fade(FadeDirection.In);
                open.Duration(500);
            });
        })
        .Items(items =>
        {
          
            items.Add()
                 .Text("Forward");

            items.Add()
                .Text("Mark as")
                .Items(children =>
                {
                    children.Add().Text("Unread");
                    children.Add().Separator(true);
                    children.Add().Text("Important");
                    children.Add().Text("Read");
                });

           
        })
    )
But it does not display any context menu. What am i doing wrong. Do i need more than a target to say where the context menu will be displayed?

Anamika

2 Answers, 1 is accepted

Sort by
0
Joseph
Top achievements
Rank 1
answered on 02 Oct 2014, 01:47 PM
I am doing the exact same feature with my grid. The only configuration that I have different (besides the animation) is that I set a Filter along with the Target.

@(Html.Kendo().ContextMenu()
        .Name("menu")
        .Target("#Grid")
        .Filter(" tr")

Good luck,
Joe
0
Dimiter Madjarov
Telerik team
answered on 03 Oct 2014, 07:30 AM
Hello Anamika,


The Context menu code is correct and works as expected on my side, assuming that the Grid id is correct. With the current configuration it will be one common context menu for the whole Grid, if you would like to display it for example for the Grid rows only and retrieve the current row, you should also add the Filter() configuration option, as Joseph suggested.

Let me know if I could assist further.

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
Grid
Asked by
Anamika
Top achievements
Rank 1
Answers by
Joseph
Top achievements
Rank 1
Dimiter Madjarov
Telerik team
Share this question
or