国产精品久久久久久2021,日韩精品无码av中文无码版,亚洲精品久久久午夜麻豆,无码成人精品日本动漫纯h

010-68421378
當前您所在的位置:首頁>新聞中心>新品發(fā)布

Kendo UI for jQuery網(wǎng)格使用教程:編輯概述

發(fā)布時間:2020/09/16 瀏覽量:3032
編輯是Kendo UI網(wǎng)格的基本功能

Kendo UI目前最新提供Kendo UI for jQuery、Kendo UI for Angular、Kendo UI Support for React和Kendo UI Support for Vue四個控件。Kendo UI for jQuery是創(chuàng)建現(xiàn)代Web應用程序的完整UI庫。

編輯是Kendo UI網(wǎng)格的基本功能,可讓您操縱其數(shù)據(jù)的顯示方式。

Kendo UI Grid提供以下編輯模式:

· 批量編輯

· 內(nèi)聯(lián)編輯

· 彈出式編輯

· 自定義編輯

 

入門指南

要啟用編輯:

· 熟悉Kendo UI中常見編輯概念

· 配置Grid的數(shù)據(jù)源

· 通過schema配置定義字段

· 設置editable選項

 

配置數(shù)據(jù)源

下面的示例演示如何為CRUD(創(chuàng)建、讀取、更新、銷毀)數(shù)據(jù)操作配置數(shù)據(jù)源。

var dataSource = new kendo.data.DataSource({
transport: {
read: "/Products",
update: {
url: "/Products/Update",
type: "POST"
},
destroy: {
url: "/Products/Destroy",
type: "POST"
},
create: {
url: "/Products/Create",
type: "POST"
}
},
// Determines if changes will be send to the server individually or as batch.
batch: true
//…
});

 

通過schema定義字段

下面的示例演示如何通過DataSource schema.model聲明字段定義。

注意

· 在schema.model.id中定義數(shù)據(jù)項的id字段,這樣可以確保正確添加、編輯和刪除項目。

· 定義字段的數(shù)據(jù)類型來利用內(nèi)置編輯器、可過濾的UI以及正確的排序、過濾和分組功能。

下圖列出了可用的數(shù)據(jù)類型:

 

var dataSource = new kendo.data.DataSource({
schema: {
model: {
id: "id",
fields: {
id: {
editable: false,
// a defaultValue will not be assigned (default value is false)
nullable: true
},
name: {
type: "string",
validation: { required: true }
},
price: {
// A NumericTextBox editor will be initialized in edit mode.
type: "number",
// When a new model is created, this default will be used.
defaultValue: 42
},
discontinued:{
// A checkbox editor will be initialized in edit mode.
type: "boolean"
},
created: {
// A date picker editor will be initialized in edit mode.
type: "date"
},
supplier: {
type: "object" ,
defaultValue: { companyName: "Progress", companyId: 1 }
}
}
}
}
});

 

設置可編輯選項

默認情況下,Grid是不可編輯的。要啟用編輯功能,請?zhí)砑铀璧木庉嬵愋?。Kendo UI jQuery Grid支持單元內(nèi)、內(nèi)聯(lián)和彈出編輯模式。為了使編輯功能完全起作用,請?zhí)砑訋в蠧reate按鈕和用于更新、銷毀操作的命令列工具欄。

下面的示例演示如何在incell編輯模式下為CRUD操作配置基本Grid。

// Incell editing.
$("#grid").kendoGrid({
// To enable the insertion of new records, save or cancel changes.
toolbar: [ "create", "save", "cancel" ],
columns: [ "name",
// To trigger the in-cell destroy operation.
{ command: [ "destroy" ] }
],
dataSource: dataSource,
editable: true
});

 

以下示例演示如何以內(nèi)聯(lián)或彈出編輯模式為CRUD操作配置基本Grid。

// Inline OR Popup editing.
$("#grid").kendoGrid({
// To enable the insertion of new records.
toolbar: [ "create" ],
columns: [ "name",
// To trigger the inline or popup edit and destroy operations.
{ command: [ "edit", "destroy" ] }
],
dataSource: dataSource,
editable: "inline" // OR editable: { mode : "popup" }
});

下一篇:SciChart Mac版:包括安卓iOS及OS平臺,支持所有您喜歡的2D和3D圖表
上一篇:Wolfram | 為成功而努力:在Mathematica中優(yōu)化平面齒輪表面

                               

 京ICP備09015132號-996 | 違法和不良信息舉報電話:4006561155

                                   © Copyright 2000-2026 北京哲想軟件有限公司版權所有 | 地址:北京市海淀區(qū)西三環(huán)北路50號豪柏大廈C2座11層1105室

                         北京哲想軟件集團旗下網(wǎng)站:哲想軟件 | 哲想動畫

                            華滋生物