1

我知道以下http://docs.telerik.com/kendo-ui/api/javascript/ui/gantt#configuration-editable.template 但这不是我需要的。

我需要显示用于应用程序其他部分的任务版本的自定义模式对话框,而不是默认的剑道对话框。

4

1 回答 1

3

这是一种可能的方法:

为编辑事件实现一个处理程序并使用 e.preventDefault() 取消 kendo 的内置处理。这将阻止他们的对话框(或模板)显示。

现在您显示您自己的对话框(但是您需要这样做)并推送传递给编辑事件的 GanttTask 数据。

当您的对话框关闭时,您将已编辑数据的值推送到 GanttTask 中……这很重要!由于您取消了内置功能,因此现在有责任更新底层数据模型。

示例编辑处理程序:

edit: function(e) {
    // Cancel the built-in editing functionality
    e.preventDefault();
    var editResult = showMyDialog(e.task);
    if (editResult.ok) {
      // User clicked OK instead of Cancel...or whatever mechanism your dialog uses.
      e.task.set("title", editResult.data.title);
      // other data...
    }
}

示例自定义对话框:

function showMyDialog(task) {
    // Fetch/show your actual window, push in the data from the GanttTask
    alert("This is my window: " + task.title);

    // Simulate user editing of GanttTask.
    var editedTitle = "NeW tAsK!";
    // other data...

    return {
      ok: true, // or false if user clicked cancel.
      data: {
        title: editedTitle
        // other data...
      }
    };
  }

简单演示:http ://dojo.telerik.com/@Stephen/apEYa

于 2016-12-14T20:27:40.770 回答