How can I get selected row data in kendo

957 Views Asked by At

I'm using this context menu example.

I used the context menu select event like this:

menu = $("#menu").kendoContextMenu({
    target: "#listview-context-menu",
    filter: ".product",
    animation: {
        open: { effects: "fadeIn" },
        duration: 500
    },
    select:  onSelect
});

function onSelect(e) {
    console.log(e);
}

It's working fine, but now I'm getting the current menu object. How can I get selected row data instead?

For example, I have right-clicked on "RE: New version of Telerik Trainer (1st one record)" and then click on reply to sender, so how can I get row object of current row.

1

There are 1 best solutions below

1
On

You can get the reference to the datarow by using the snippet below

function onSelect(e) {                           
    var lst =$("#listview-context-menu").getKendoListView();
    var row = lst.dataItem(e.target);
    console.log(row);
}

Please refer the fiddle here for a demo