龙空技术网

UI组件Kendo UI for jQuery数据管理入门指南 - TaskBoard/编辑

慧都科技 191

前言:

目前看官们对“jquerydropdown赋值”大致比较注意,你们都需要知道一些“jquerydropdown赋值”的相关资讯。那么小编也在网摘上搜集了一些有关“jquerydropdown赋值””的相关内容,希望姐妹们能喜欢,看官们一起来了解一下吧!

Kendo UI TaskBoard允许列和卡片编辑,默认情况下,列和卡片都启用了TaskBoard中的编辑。

Kendo UI官方最新版免费下载试用,历史版本下载,在线文档和帮助文件下载-慧都网

编辑配置

要设置编辑:

1. 配置TaskBoard的transport和schema数据源选项。

2. 设置editable配置(可选)。

以下示例演示如何为 TaskBoard 的列和卡片配置 CRUD(创建、读取、更新、销毁)数据操作。

<div id="taskBoard"></div><script>var crudServiceBaseUrl = ";;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 为其列和卡片使用两个不同的数据源实例。

注意:

在transport配置中定义数据操作。在 schema.model.id 中定义数据项的 id 字段,这可确保正确添加、编辑和删除项目。定义模型字段。

以下示例演示如何配置列的数据源。

columns: {transport: {read: {url: ";},create: {url: ";,method: "POST"},update: {url: ";,method: "POST"},destroy: {url: ";,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: ";},create: {url: ";,method: "POST"},update: {url: ";,method: "POST"},destroy: {url: ";,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

Kendo UI for jQuery是完整的jQuery UI组件库,可快速构建出色的高性能响应式Web应用程序。Kendo UI for jQuery提供在短时间内构建现在Web应用程序所需要的一切,从多个UI组件中选择,并轻松地将它们组合起来,创建出酷炫响应式的应用程序,同时将开发时间加快了50%。

标签: #jquerydropdown赋值