Search code examples
angularjstelerikkendo-grid

How can i do a mouse click on Kendoui Grid and popup a window using AngularJS?


I am doing a double click on kendoui grid with the following code

     dataBound: function (e) {
            var grid = this;
            grid.tbody.find("tr").dblclick(function (e)
            {
                var dataItem = grid.dataItem(this);
                alert(dataItem.Name); 

            });
        }

I get the row data correctly, but how can i do this using right mouseclick which gives a drop down option selection , cant find any demos by Telerik ??


Solution

  • You can use javaScript oncontextmenu:

    dataBound: function (e) {
        var grid = this;
    
        grid.tbody.find("tr").dblclick(function (e) {
            var dataItem = grid.dataItem(this);
            alert(dataItem.Name);
        });
    
        grid.tbody.find("tr").on('contextmenu', function (a) {
            a.preventDefault();
            var dataItem = grid.dataItem(this);
            alert(dataItem.name)
        });
    }
    

    This will disable the right-click context menu and add your functionality when you right-click the grids tr element.

    Example: Right click event (oncontextmenu)