我在 JSP 页面中显示 Kendo UI 网格。这是代码。我为 create 方法设计了一个 web 服务。该方法被调用。但我无法访问模型字段。意味着我想访问所选行的字段值,将其插入数据库。我怎样才能访问它?.
<div id="example">
<div id="grid"></div>
<script>
$(document).ready(function () {
var crudServiceBaseUrl = "http://localhost:8081/app/personcontacttypes",
dataSource = new kendo.data.DataSource({
transport: {
read: {
url: crudServiceBaseUrl + "/getAll",
dataType: "json"
},
update: {
url: crudServiceBaseUrl + "/update",
dataType: "json"
},
destroy: {
url: crudServiceBaseUrl + "/delete",
dataType: "json"
},
create: {
url: crudServiceBaseUrl + "/Create",
dataType: "json"
},
parameterMap: function(options, operation) {
if (operation !== "read" && options.models) {
return {models: kendo.stringify(options.models)};
}
}
},
batch: true,
pageSize: 20,
schema: {
model: {
id: "personContactId",
fields: {
personContactId: { editable: false, nullable: true },
dropDown: { editable: true, nullable: true },
formattedAppearnce: { editable: true, nullable: true },
fullDefination: { editable: true, nullable: true },
notes: { editable: true, nullable: true }
}
}
}
});
$("#grid").kendoGrid({
dataSource: dataSource,
navigatable: true,
pageable: true,
height: 550,
toolbar: ["create", "save", "cancel"],
columns: [
{ field: "formattedAppearnce", title: "Formatted Appearance", format: "{0:c}", width: 140 },
{ field: "dropDown", title: "Drop Down", format: "{0:c}", width: 140 },
{ field: "fullDefination", title: "Full Defination", width: 140 },
{ field: "notes", width: 190 },
{ command: "destroy", title: " ", width: 50 }],
editable: true
});
});
</script>
</div>