Kendo UI Gantt - 显示任务更新的自定义模式

时间:2016-12-14 19:53:26

标签: kendo-ui kendo-gantt

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

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

1 个答案:

答案 0 :(得分:2)

这是一种可能的方式:

为edit事件实现处理程序,并使用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

相关问题