Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 如何在GoJs中向流程图添加上下文菜单_Jquery_Gojs - Fatal编程技术网

Jquery 如何在GoJs中向流程图添加上下文菜单

Jquery 如何在GoJs中向流程图添加上下文菜单,jquery,gojs,Jquery,Gojs,我正在使用 现在我必须在GoJs流程图中集成上下文菜单,如下面的链接所示 请帮助我如何操作…在我正在流程图上创建上下文菜单的示例代码中,上下文菜单将显示两个菜单项“添加注释”和“编辑注释”。它将打开一个剑道窗口来添加或编辑注释 首先在html文件中创建一个div <div id="contextMenu"> <ul> <li><a href="#" id="addNotes">Add Notes</a></l

我正在使用

现在我必须在GoJs流程图中集成上下文菜单,如下面的链接所示


请帮助我如何操作…

在我正在流程图上创建上下文菜单的示例代码中,上下文菜单将显示两个菜单项“添加注释”和“编辑注释”。它将打开一个剑道窗口来添加或编辑注释

首先在html文件中创建一个div

<div id="contextMenu">
   <ul>
      <li><a href="#" id="addNotes">Add Notes</a></li>    
      <li><a href="#" id="EditNotes" onclick="editNotes()">Edit Notes</a></li>
   </ul>
</div>    

<div id="window">
   <div class="text">
      <textarea id="myTelText" style="width: 500px; height: 300px;"></textarea> 
      <button class="k-button" id="Save" onclick="SetRemark()">Save</button>
   </div>
</div>

您有一个例子,那么您的代码尝试中的问题是什么???实际上jquery非常复杂,很难根据我们的需要进行修改
<style>
    #contextMenu{z-index:300;position:absolute;left:5px;border:1px solid #444;background-color:#F5F5F5;display:none;box-shadow:0 0 10px rgba(0,0,0,.4);font-size:12px;font-family:sans-serif;font-weight:700}
    #contextMenu ul{list-style:none;top:0;left:0;margin:0;padding:0}
    #contextMenu li{position:relative;min-width:60px}
    #contextMenu a{color:#444;display:inline-block;padding:6px;text-decoration:none}
    #contextMenu li:hover{background:#444}
    #contextMenu li:hover a{color:#EEE}
</style>
var contextMenu;
$(function() {
    initTelerikPopUp();
});

//-- initialize context menu and kendo popup.
function initTelerikPopUp() {
  var window = $("#window"),
  contextMenu = $("#contextMenu"),
      undo = $("#addNotes")
      .bind("click", function() {
          window.data("kendoWindow").open();
          contextMenu.hide();
      });

  function onClose(){

  }

  // initialize popup window      
  if (!window.data("kendoWindow")) {
      window.kendoWindow({
          visible: false,
          width: "600px",
          title: "Remarks",
          actions: [
              "Pin",
              "Minimize",
              "Maximize",
              "Close"
          ],

          close: onClose
      });
  }
}   

  myDiagram.contextMenu = $(go.Adornment);
    // This is the actual HTML context menu:
    var cxElement = document.getElementById("contextMenu");

    // We don't want the div acting as a context menu to have a (browser) context menu!
    cxElement.addEventListener("contextmenu", function (e) { e.preventDefault(); return false; }, false);
    cxElement.addEventListener("blur", function (e) { cxMenu.stopTool(); }, false);

    // Override the ContextMenuTool.showContextMenu and hideContextMenu methods
    // in order to modify the HTML appropriately.
    var cxTool = myDiagram.toolManager.contextMenuTool;

    // This is the override of ContextMenuTool.showContextMenu:
    // This does not not need to call the base method.
    cxTool.showContextMenu = function (contextmenu, obj) {        
        // Hide any other existing context menu
        if (contextmenu !== this.currentContextMenu) {
            this.hideContextMenu();
        }

        cxElement.style.display = "block";

        // Remember that there is now a context menu showing
        this.currentContextMenu = contextmenu;
    }

    // This is the corresponding override of ContextMenuTool.hideContextMenu:
    // This does not not need to call the base method.
    cxTool.hideContextMenu = function () {
        if (this.currentContextMenu === null) return;
        cxElement.style.display = "none";
        this.currentContextMenu = null;
    }

// this function will call on editnotes button click    
function editNotes() {
   // clicked on edit notes context menu item
}