我在我的应用中使用dojox/calendar/Calendar
,使用dojo/store/JsonRest
商店。移动日历条目时,它会正确调用REST URL来更新条目,并收到一个成功的响应,我可以在浏览器中的开发人员工具的网络选项卡下看到。
但是,任何以这种方式移动的项目都会变得无法响应。我可以看到它有类Storing
,所以框架似乎认为该项仍然存储并且没有响应。
这是我在app.js中的代码:
require(["dojo/ready", "dojox/calendar/Calendar", "dojo/store/JsonRest", "dojo/store/Observable"],
function (ready, Calendar, JsonRest, Observable) {
ready(function () {
var appointmentStore = JsonRest({target: '/api/appointments'});
var calendar = new Calendar({
date: new Date(2008, 05, 08),
dateInterval: "month",
store: new Observable(appointmentStore),
startTimeAttr: "start",
endTimeAttr: "end",
query: '?activity_type_code=ZD03',
style: "position:relative;width:800px;height:500px"
}, "calendar");
});
});
这些是更新项目的XHR请求响应的标题:
Connection:Keep-Alive
Content-Length:877
Content-Type:application/json
Date:Thu, 12 Nov 2015 05:25:08 GMT
Server:WEBrick/1.3.1 (Ruby/2.1.6/2015-04-13)
X-Content-Type-Options:nosniff
(我首先想到的问题是我没有将响应类型设置为JSON,但即使这样做,它仍然无效)。
这是日历事件div标签,让我认为就日历而言,更新并不完整(因为存在'存储'类):
<div class="dojoxCalendarEvent dojoxCalendarVertical Storing" onselectstart="return false;" id="dojox_calendar_VerticalRenderer_0" widgetid="dojox_calendar_VerticalRenderer_0" style="z-index: 0; top: 400px; left: 0%; width: 100%; height: 101px; display: block;">
答案 0 :(得分:0)
I had somehow overlooked that there was an error on the console. The problem is that the web service being called in the background does not return the definition of the calendar item / appointment, and the Dojo calendar framework is looking for the begin and end dates in the response. As a result, it is raising an error, and as far as it is concerned, the storing of the item is not complete.