在kendoUI中如何修改requestEnd的event.response和event.type?
In kendoUI how do you modify the event.response and event.type of requestEnd?
我设法更改了 kendoGrid.dataSource.transport.options.create.url 的端点并将其重定向到不同的端点
有没有办法更改此代码中的 e.response 和 e.type?代码如下。 我说的是requestEnd回调的参数
requestEnd: function (e) {
var response = e.response;
var type = e.type;
console.log(e, 'I am event');
console.log("i triggered again and i am response", response);
console.log("i am type", type);
return 0;
if (type !== "read") {
toastr.options = {
positionClass: "toast-top-right"
};
if (type === 'update') {
if (!response.success) {
toastr.error(response.errorMessage, 'Account Update');
} else {
toastr.info('Acount detail successfully updated', 'Account Update');
}
} else if (type === 'create') {
if (!response.success) {
toastr.error(response.errorMessage, 'Message');
} else {
toastr.info('New Account successfully added', 'Message');
}
}
$('#grid').data('kendoGrid').dataSource.read();
$('#grid').data('kendoGrid').refresh();
}
},
非常感谢您的帮助!任何可以帮助我的人都应该得到加薪:)
我会改变解决这个问题的方法。您可以根据 complete
部分中的类型捕获每个请求的响应。控制台日志 response
和 errorThrown
以查看您从服务器获得了什么
transport: {
read: {
url: '',
type: 'GET',,
contentType: 'application/json',
complete: function(response, errorThrown) {
if (errorThrown === 'error') {
toastr.error(response.errorMessage, 'Account Read')
} else {
var responseData = response.responseJSON.accounts; //presumably array of accounts
toastr.info('Acounts fetched', 'Account Read');
}
}
},
update: {
url: '',
type: 'POST',
contentType: 'application/json',
complete: function (response, errorThrown) {
if (errorThrown === 'error') {
toastr.error(response.errorMessage, 'Account Update')
} else {
toastr.info('Acount detail successfully updated', 'Account Update');
}
}
}
}
我设法更改了 kendoGrid.dataSource.transport.options.create.url 的端点并将其重定向到不同的端点
有没有办法更改此代码中的 e.response 和 e.type?代码如下。 我说的是requestEnd回调的参数
requestEnd: function (e) {
var response = e.response;
var type = e.type;
console.log(e, 'I am event');
console.log("i triggered again and i am response", response);
console.log("i am type", type);
return 0;
if (type !== "read") {
toastr.options = {
positionClass: "toast-top-right"
};
if (type === 'update') {
if (!response.success) {
toastr.error(response.errorMessage, 'Account Update');
} else {
toastr.info('Acount detail successfully updated', 'Account Update');
}
} else if (type === 'create') {
if (!response.success) {
toastr.error(response.errorMessage, 'Message');
} else {
toastr.info('New Account successfully added', 'Message');
}
}
$('#grid').data('kendoGrid').dataSource.read();
$('#grid').data('kendoGrid').refresh();
}
},
非常感谢您的帮助!任何可以帮助我的人都应该得到加薪:)
我会改变解决这个问题的方法。您可以根据 complete
部分中的类型捕获每个请求的响应。控制台日志 response
和 errorThrown
以查看您从服务器获得了什么
transport: {
read: {
url: '',
type: 'GET',,
contentType: 'application/json',
complete: function(response, errorThrown) {
if (errorThrown === 'error') {
toastr.error(response.errorMessage, 'Account Read')
} else {
var responseData = response.responseJSON.accounts; //presumably array of accounts
toastr.info('Acounts fetched', 'Account Read');
}
}
},
update: {
url: '',
type: 'POST',
contentType: 'application/json',
complete: function (response, errorThrown) {
if (errorThrown === 'error') {
toastr.error(response.errorMessage, 'Account Update')
} else {
toastr.info('Acount detail successfully updated', 'Account Update');
}
}
}
}