Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1215
Right-click grid event handler in MVC app
posted

How do you wire up a right-click event handler for an IgniteUI grid in an MVC app?

I need the jQuery event.clientX and clientY to open a context menu at the mouse cursor.

I also need the grid row id and right-clicked-cell.

Also: this right-click may occur over a row that is not selected. It may occur over any row, any cell, regardless of whether they are selected or not. I still need all the information above, even if there is no selection.

Parents
No Data
Reply
  • 1320
    Verified Answer
    Offline posted

    Hello Ray,

    After investigating this further, I have determined that your requirement could be achieved by binding a method to the javascript contextmenu event.

    Additionally, the right clicked cell could be accessed from the target of the event argument and the row id from the parent of the cell. This could be achieved as follows:

    $("#gridProducts").contextmenu(function (evt) {

                    let cell = evt.target;

                    let rowID = evt.target.parentElement.attributes["data-id"].value;

                    let cellIndex = cell.cellIndex

                    let columnKey = $("#gridProducts").igGrid("option", "columns")[cellIndex].key;

    });

    Please test it on your side and let me know if you need any further information regarding this matter.

    Regards,
    Monika Kirkova,
    Infragistics

Children