原創(chuàng)|使用教程|編輯:龔雪|2022-04-19 10:35:55.927|閱讀 170 次
概述:本文主要為大家介紹Kendo UI for jQuery控件的任務(wù)板是如何編輯列和卡片的,歡迎下載最新版控件體驗(yàn)!
# 界面/圖表報(bào)表/文檔/IDE等千款熱門(mén)軟控件火熱銷(xiāo)售中 >>
相關(guān)鏈接:
Kendo UI TaskBoard允許列和卡片編輯,默認(rèn)情況下,列和卡片都啟用了TaskBoard中的編輯。
要設(shè)置編輯:
1. 配置TaskBoard的transport和schema數(shù)據(jù)源選項(xiàng)。
2. 設(shè)置editable配置(可選)。
以下示例演示如何為 TaskBoard 的列和卡片配置 CRUD(創(chuàng)建、讀取、更新、銷(xiāo)毀)數(shù)據(jù)操作。
<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 為其列和卡片使用兩個(gè)不同的數(shù)據(jù)源實(shí)例。
注意:
以下示例演示如何配置列的數(shù)據(jù)源。
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" } } } } }
以下示例演示如何配置卡片的數(shù)據(jù)源。
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" } } } } }
默認(rèn)情況下啟用編輯,但可編輯配置公開(kāi)了許多自定義選項(xiàng)。
以下示例演示了如何設(shè)置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組件庫(kù),可快速構(gòu)建出色的高性能響應(yīng)式Web應(yīng)用程序。Kendo UI for jQuery提供在短時(shí)間內(nèi)構(gòu)建現(xiàn)在Web應(yīng)用程序所需要的一切,從多個(gè)UI組件中選擇,并輕松地將它們組合起來(lái),創(chuàng)建出酷炫響應(yīng)式的應(yīng)用程序,同時(shí)將開(kāi)發(fā)時(shí)間加快了50%。
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn