原創|使用教程|編輯:龔雪|2022-04-19 10:35:55.927|閱讀 170 次
概述:本文主要為大家介紹Kendo UI for jQuery控件的任務板是如何編輯列和卡片的,歡迎下載最新版控件體驗!
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
Kendo UI TaskBoard允許列和卡片編輯,默認情況下,列和卡片都啟用了TaskBoard中的編輯。
要設置編輯:
1. 配置TaskBoard的transport和schema數據源選項。
2. 設置editable配置(可選)。
以下示例演示如何為 TaskBoard 的列和卡片配置 CRUD(創建、讀取、更新、銷毀)數據操作。
<div id="taskBoard"></div> <script> var crudServiceBaseUrl = "http://demos.telerik.com/kendo-ui/service"; var priorities = new kendo.data.DataSource({ data: [ { value: "urgent", text: "Urgent", color: "orange" }, { value: "highpriority", text: "High Priority", color: "blue" }, { value: "lowpriority", text: "Low Priority", color: "green" } ] }); $("#taskBoard").kendoTaskBoard({ columnSettings: { dataTextField: "Text", dataStatusField: "Status", dataOrderField: "Order" }, columns: { transport: { read: { url: crudServiceBaseUrl + "/taskboard/columns" }, create: { url: crudServiceBaseUrl + "/taskboard/columns_create", method: "POST" }, update: { url: crudServiceBaseUrl + "/taskboard/columns_update", method: "POST" }, destroy: { url: crudServiceBaseUrl + "/taskboard/columns_destroy", method: "POST" } }, schema: { model: { id: "ID", fields: { "ID": { type: "number" }, "Text": { type: "string" }, "Status": { type: "string", defaultValue: "todo" }, "Order": { type: "number" } } } } }, dataCategoryField: "Category", dataDescriptionField: "Description", dataTitleField: "Title", dataStatusField: "Status", dataOrderField: "Order", dataSource: { transport: { read: { url: crudServiceBaseUrl + "/taskboard" }, create: { url: crudServiceBaseUrl + "/taskboard/create", method: "POST" }, update: { url: crudServiceBaseUrl + "/taskboard/update", method: "POST" }, destroy: { url: crudServiceBaseUrl + "/taskboard/destroy", method: "POST" } }, schema: { model: { id: "ID", fields: { "ID": { type: "number" }, "Category": { type: "string", defaultValue: "lowpriority" }, "Description": { type: "string" }, "Title": { type: "string", validation: { required: true } }, "Status": { type: "string", defaultValue: "todo" }, "Order": { type: "number" } } } } }, resources: [{ field: "Category", title: "Priority", dataSource: priorities }], previewPane: { template: "<p>#:Description#</p>" + "<p>#:resources.Category.title#: <span style='background-color: #:resources.Category.color#'> </span> #:resources.Category.text#</p>" }, editable: { form: { buttonsTemplate: "", items: [{ field: "Title", label: "Title:" }, { field: "Description", label: "Description:" }, { field: "Category", label: "Priority:", editor: "DropDownList", editorOptions: { dataTextField: "text", dataValueField: "value", dataSource: priorities, template: "<span style='background-color: #:color#'> </span> #:text#", valueTemplate: "<span style='background-color: #:color#'> </span> #:text#" } }] } }, height: 750 }); </script>
TaskBoard 為其列和卡片使用兩個不同的數據源實例。
注意:
以下示例演示如何配置列的數據源。
columns: { transport: { read: { url: "http://demos.telerik.com/kendo-ui/service/taskboard/columns" }, create: { url: "http://demos.telerik.com/kendo-ui/service/taskboard/columns_create", method: "POST" }, update: { url: "http://demos.telerik.com/kendo-ui/service/taskboard/columns_update", method: "POST" }, destroy: { url: "http://demos.telerik.com/kendo-ui/service/taskboard/columns_destroy", method: "POST" } }, schema: { model: { id: "ID", fields: { "ID": { type: "number" }, "Text": { type: "string" }, "Status": { type: "string", defaultValue: "todo" }, "Order": { type: "number" } } } } }
以下示例演示如何配置卡片的數據源。
dataSource: { transport: { read: { url: "http://demos.telerik.com/kendo-ui/service/taskboard" }, create: { url: "http://demos.telerik.com/kendo-ui/service/taskboard/create", method: "POST" }, update: { url: "http://demos.telerik.com/kendo-ui/service/taskboard/update", method: "POST" }, destroy: { url: "http://demos.telerik.com/kendo-ui/service/taskboard/destroy", method: "POST" } }, schema: { model: { id: "ID", fields: { "ID": { type: "number" }, "Category": { type: "string", defaultValue: "lowpriority" }, "Description": { type: "string" }, "Title": { type: "string", validation: { required: true } }, "Status": { type: "string", defaultValue: "todo" }, "Order": { type: "number" } } } } }
默認情況下啟用編輯,但可編輯配置公開了許多自定義選項。
以下示例演示了如何設置editable配置。
editable: { form: { buttonsTemplate: "", items: [{ field: "Title", label: "Title:" }, { field: "Description", label: "Description:" }, { field: "Category", label: "Priority:", editor: "DropDownList", editorOptions: { dataTextField: "text", dataValueField: "value", dataSource: priorities, template: "<span style='background-color: #:color#'> </span> #:text#", valueTemplate: "<span style='background-color: #:color#'> </span> #:text#" } }] } }
Kendo UI for jQuery是完整的jQuery UI組件庫,可快速構建出色的高性能響應式Web應用程序。Kendo UI for jQuery提供在短時間內構建現在Web應用程序所需要的一切,從多個UI組件中選擇,并輕松地將它們組合起來,創建出酷炫響應式的應用程序,同時將開發時間加快了50%。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn