【发布时间】:2014-10-20 14:32:32
【问题描述】:
我的代码中有一个支持destroy 的DataSource。为了从中删除对象,我直接调用remove,即
myDataSource.remove(discardedData);
我的行为类似于this。但是,与链接线程不同,我的 destroy 没有设置为函数,因此该解决方案对我没有帮助。
我的数据源(我包括了所有这些,以防我的某些配置受到指责):
var QueueMessages = {
type: "aspnetmvc-ajax",
transport: {
read: {
url: BASE_URL + "api/QueueMessages/GetMessagesHeaders",
dataType: "json",
type: "GET",
beforeSend: function (req) {
req.setRequestHeader('Authorization', authService.getAuth());
}
},
destroy: {
url: BASE_URL + "api/QueueMessages/deleteMessage",
dataType: "json",
type: "DELETE",
beforeSend: function (req) {
req.setRequestHeader('Authorization', authService.getAuth());
}
}
},
schema: {
model: {
id: "id",
fields: {
profileName: { type: "string" },
queueType: { type: "string" },
acceptedAt: { type: "date" },
processedAt: { type: "date" },
BodyExcerpt: { type: "string" }
}
},
total: "total",
data: "data",
},
error: function (e) {
//throw user back to login page
if (e.errorThrown === "Unauthorized")
$rootScope.$apply($location.path('/'));
},
requestStart: function () {
},
requestEnd: function () {
},
pageSize: 50,
serverPaging: true,
serverFiltering: true,
serverSorting: true,
serverGrouping: true,
serverAggregates: true
};
我找不到任何关于为什么会发生这种情况的线索。
【问题讨论】:
-
问题可能与您引用的链接中的相同:执行破坏的结果并未告知它已正确完成。您的服务应返回适当的结果,以通知
destroy它已被实际删除。
标签: kendo-ui kendo-grid kendo-datasource