Adding jQuery ContextMenu to Gridview

I have a menu right here. But where to add the menu to the script so that I can get the context menu in the grid.

// HTML

<ul id="myMenu" class="contextMenu"> <li class="insert"><a href="#insert">Add New</a></li> <li class="edit"><a href="#edit">Edit</a></li> <li class="delete"><a href="#delete">Delete</a></li> </ul> 

// Script

  $(document).ready(function () { $(".customerRow").contextMenu(function (action, el, pos) { contextMenuWork(action, el, pos); }); }); 
+4
source share
1 answer

Try adding a menu after the context menu to your script.

Replace:

 $(document).ready(function () { $(".customerRow").contextMenu(function (action, el, pos) { contextMenuWork(action, el, pos); }); }); 

WITH

 $(document).ready(function () { $(".customerRow").contextMenu({ menu: 'myMenu' }, function (action, el, pos) { contextMenuWork(action, el, pos); }); }); 
+2
source

Source: https://habr.com/ru/post/1469446/


All Articles