GANI
GANI

Reputation: 2049

how to get cell click event in kendo grid

My grid is

    @(Html.kendo().Grid<StudentViewModel>()
       .Columns( x=>
       {
        x.Bound( y => y.StudentId);
        x.Bound(y => y.SubjectId);
        x.Bound(y => y.Name);
      })

here when user clicks on "StudentId" or "SubjectId" cell in those columns want to show a popup, how to get the cell click event and verify that is the right column. How to get the cell click event ?

Upvotes: 2

Views: 13132

Answers (3)

Paige
Paige

Reputation: 73

To add onto the previous answers: In your grid, add an event binding

@(Html.kendo().Grid<StudentViewModel>()
   .Columns(...)
   .Events(events => events.Change("onChange"))
  })

Then, in your javascript section, add a function like Arturo suggested:

function onChange(arg) {
    var selected = $.map(this.select(), function (item) {
        return $(item).text();
    });
}

This example from Telerik might help: http://demos.telerik.com/aspnet-mvc/grid/events

Upvotes: 2

Arturo Romero Marquez
Arturo Romero Marquez

Reputation: 49

you can check the event documentation here: http://docs.telerik.com/kendo-ui/getting-started/framework/mvvm/bindings/events

Upvotes: 0

Arturo Romero Marquez
Arturo Romero Marquez

Reputation: 49

You can do something like:

 function onChange(arg) {
                var selected = $.map(this.select(), function(item) {
                    return $(item).text();
                });

And add anything inside you want to be executed.

Upvotes: 0

Related Questions