Search code examples
jquerykendo-uikendo-gridkendo-ui-mvckendo-contextmenu

How to apply Kendo Context menu filter to skip first two grid columns


I am creating kendo context menu and I want to show it only when users right click on the kendo grid. I am able to restrict the user to show kendo context menu only when user right clicks on the grid. But now I have to hide the context menu for the first two columns of grid and when user right click on the rest of columns kendo context menu should appear.

Below is the code which I am trying but it is not working.

$("#contextMenu").kendoContextMenu({
 target: "#grid",
 filter: ".k-grid-content tbody tr[role='row'] td:not(:nth-child(1), :nth-child(2))"
});

Any help is highly appreciated


Solution

  • How about rather than excluding the first two, you only include the rest? Something like:

    $("#contextMenu").kendoContextMenu({
     target: "#grid",
     filter: ".k-grid-content tbody tr[role='row'] td:nth-child(n+3)"
    });