2016-12-14 42 views
0

我知道以下http://docs.telerik.com/kendo-ui/api/javascript/ui/gantt#configuration-editable.template 但它不是我所需要的。Kendo UI甘特 - 顯示任務更新的自定義模式

我需要顯示任務版本的自定義模態對話框,用於應用程序的其他部分而不是默認的kendo對話框。

+0

這是什麼定製的模態樣的?你不能讓模板定義等於自定義模式的標記。 –

+0

您是否知道我可以禁用默認kendo對話框中的開始和結束驗證以編輯任務的方式? –

回答

2

這裏是一個可能的方式:

實施編輯事件的處理程序,並使用e.preventDefault()取消劍道的內置處理。這將阻止他們的對話(或模板)顯示。

現在,您顯示自己的對話框(但您需要這樣做),並推送傳遞給編輯事件的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

+0

非常感謝,它效果很棒! –

相關問題