Kendo ui 剑道数据源更新功能未启动
我知道这个问题已经被问到了,我已经一遍又一遍地回顾了答案。我仍然无法启动这个剑道数据源更新函数。它在没有函数(e){}的情况下激发 这很有效。不起作用的是当我尝试将更新作为一个函数实现时Kendo ui 剑道数据源更新功能未启动,kendo-ui,kendo-grid,Kendo Ui,Kendo Grid,我知道这个问题已经被问到了,我已经一遍又一遍地回顾了答案。我仍然无法启动这个剑道数据源更新函数。它在没有函数(e){}的情况下激发 这很有效。不起作用的是当我尝试将更新作为一个函数实现时 update: function(e) { debugger alert("update") $.ajax({ url: &qu
update: function(e)
{
debugger
alert("update")
$.ajax({
url: "/SettingsAdmin/UpdateGrid",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
data: {
models: kendo.stringify(e.data.models)
},
success: function (result) {
alert(e.success(result));
},
error: function (result) {
alert(e.error(result))
e.error(result);
}
});
},
update: function(e)
{ }
下面是定义的整个数据源
return new kendo.data.DataSource({
transport: {
read: {
url: url,
contentType: 'application/json; charset=utf-8',
type: "POST",
dataType: "json"
},
update:
{
url: "/SettingsAdmin/UpdateGrid",
dataType: "json",
type: "POST",
//data: {
// result: kendo.stringify(result.data)
//},
},
update: function(e)
{
debugger
alert("update")
$.ajax({
url: "/SettingsAdmin/UpdateGrid",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
data: {
models: kendo.stringify(e.data.models)
},
success: function (result) {
alert(e.success(result));
},
error: function (result) {
alert(e.error(result))
e.error(result);
}
});
},
parameterMap: function (data, operation) {
return JSON.stringify(data);
}
},
schema:
{
data: "result.data",
total: "result.total",
aggregates: "result.aggregates",
groups: "result.groups",
errors: "result.errors",
model:
{
id: "name",
//fields: {
// //id: { required: false, type: 'number', nullable: true },
// name: { editable: false, type: "string" },
// value: { editable: true, type: "string" }
//}
}
},
pageSize: 10,
batch: false,
serverPaging: true,
serverFiltering: true,
serverSorting: true,
});
所有传输操作(读取、更新、创建、销毁)都必须以我没有使用的方式定义。我把我的阅读行为定义为
read: {
url: url,
contentType: 'application/json; charset=utf-8',
type: "POST",
dataType: "json"
},
然后用一个函数进行更新
update: function(e)
{
debugger
alert("update")
$.ajax({
url: "/SettingsAdmin/UpdateGrid",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
data: {
models: kendo.stringify(e.data.models)
},
success: function (result) {
alert(e.success(result));
},
error: function (result) {
alert(e.error(result))
e.error(result);
}
});
},
update: function(e)
{ }
不能那样做。我需要将read:定义为一个函数
update: function(e)
{
debugger
alert("update")
$.ajax({
url: "/SettingsAdmin/UpdateGrid",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
data: {
models: kendo.stringify(e.data.models)
},
success: function (result) {
alert(e.success(result));
},
error: function (result) {
alert(e.error(result))
e.error(result);
}
});
},
update: function(e)
{ }