I am implementing a context menu for my kendo grid on MVC page. I am trying to call the edit button on my kendo grid using on click of the context menu. I have implemented event on my context menu and on the event written jquery code to call fire the click event of the edit button. I do see the window popping up for a split second and closing. How do I get this working
@(Html.Kendo().ContextMenu()
.Name("menu")
.Target("#GridTeam")
.Filter("tr")
.Orientation(ContextMenuOrientation.Vertical)
.Animation(animation =>
{
animation.Open(open =>
{
open.Fade(FadeDirection.In);
open.Duration(500);
});
})
.Items(items =>
{
items.Add()
.Text("Edit");
items.Add()
.Text("Delete");
})
.Events(e =>
{
e.Select("onEdit");
})
)
function onEdit(e) {
//Logic to be executed on Edit event
$('a.k-grid-edit').click();
This should work. First you get your grid instance. Then from context menu event find which row was clicked on. And then just put that row into edit mode.
You can use addRow, editRow and removeRow.
Model
View
Controller
Screen Shot