我使用从sql过程中获得的dataJSON作为提要,并加载日历,但没有从中填充,json格式是正确的,我已经将其作为静态输入进行了测试,但当我将数据作为提要时,它就不起作用
jQuery(document).ready(function () {
callJsonWs("EXECUTE procedureName + some entry parametars ","loadPageGather");
});
之后,我转到loadPageGather函数,该函数填充日历
function loadPageGather(dataJSON) {
var data
try {
data = JSON.parse(dataJSON);
}
catch (err) {
alert("ERROR - " + err.message)
}
$('#calendar').fullCalendar({
events: data.timetable,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
droppable: true,
resizable: true,
timeFormat: 'HH:mm',
eventTextColor: '#3498db',
eventDrop: function (event, delta, revertFunc) {
var start = event.start.format()
var end = event.end.format()
var semesterStudyProgramUnitObligationCode = event.semesterStudyProgramUnitObligationCode
var timetableCode = event.id
eventUpdate(start, end, semesterStudyProgramUnitObligationCode, timetableCode)
},
// EVENT DELETE
eventDragStop: function (event, jsEvent) {
var semesterStudyProgramUnitObligationCode = event.semesterStudyProgramUnitObligationCode
var timetableCode = event.id
var trashEl = jQuery('#asideDiv');
var ofs = trashEl.offset();
var x1 = ofs.left;
var x2 = ofs.left + trashEl.outerWidth(true);
var y1 = ofs.top;
var y2 = ofs.top + trashEl.outerHeight(true);
if (jsEvent.pageX >= x1 && jsEvent.pageX <= x2 &&
jsEvent.pageY >= y1 && jsEvent.pageY <= y2) {
$('#calendar').fullCalendar('removeEvents', event.id);
callJsonWs("dskrbic", "EXECUTE hereIs delete procedure);
}
},
// EVENT RESIZE
eventResize: function (event, minuteDelta, revertFunc) {
var start = event.start.format()
var end = event.end.format()
var semesterStudyProgramUnitObligationCode = event.semesterStudyProgramUnitObligationCode
var timetableCode = event.id
eventUpdate(start, end, semesterStudyProgramUnitObligationCode, timetableCode)
});
这是我得到的json的格式:
{"timetable" : [ {"semesterStudyProgramUnitObligationCode":"20","id":"1","start":"2016-01-02T10:00:00","end":"2016-01-02T13:00:00","semesterName":"First","title":"OPERATIVNI SISTEMI - Lectures","description":"Kampus - Zgrada - Classroom - 12"},]}
我是新手,我做错了吗?告诉我你的意见,谢谢
小更新出于某种原因,如果我把loadPageGather()放在文档中的callJsonWs之后,它就可以工作了,我的所有功能都可以工作,除了asside的一部分是missing和asside meni不工作,如果我删除它,它只加载日历,它的日历功能都不工作(删除、更新等等)。。。。
FIXED通过添加所有日历函数,并加载到文档就绪状态,而在其他函数中,只需使用填充数据
$('#calendar').fullCalendar('addEventSource', data.timetable);