Javascript 将Fullcalendar更新为2.2.3后出现运行时错误
我正在更新应用程序以使用最新版本的Fullcalendar 2.2.3。我用的是1.6.4 当更新到当前版本时,当fullcalendar尝试准备检索事件数据时,我收到一个运行时错误。当它点击下面的函数时,rangeStart和rangeEnd变量为null,当应用.clone方法时,生成null引用。下面是fullcalendar.js中的函数,该函数从发生错误的第1401行开始Javascript 将Fullcalendar更新为2.2.3后出现运行时错误,javascript,jquery-ui,fullcalendar,Javascript,Jquery Ui,Fullcalendar,我正在更新应用程序以使用最新版本的Fullcalendar 2.2.3。我用的是1.6.4 当更新到当前版本时,当fullcalendar尝试准备检索事件数据时,我收到一个运行时错误。当它点击下面的函数时,rangeStart和rangeEnd变量为null,当应用.clone方法时,生成null引用。下面是fullcalendar.js中的函数,该函数从发生错误的第1401行开始 function _fetchEventSource(source, callback) { va
function _fetchEventSource(source, callback) {
var i;
var fetchers = fc.sourceFetchers;
var res;
for (i=0; i<fetchers.length; i++) {
res = fetchers[i].call(
t, // this, the Calendar object
source,
rangeStart.clone(), <== rangeStart is null and causes null reference error here
rangeEnd.clone(),
options.timezone,
callback
);
if (res === true) {
// the fetcher is in charge. made its own async request
return;
}
else if (typeof res == 'object') {
// the fetcher returned a new source. process it
_fetchEventSource(res, callback);
return;
}
}
日历位于选项卡中。这是选中选项卡时为显示日历而调用的行
$('#calendar').fullCalendar('refetchEvents')
是否需要更改日历对象的定义或调用方式?我通过更改视图中对.fullCalendar的引用顺序来解决此问题。显然,在版本1.6.4中,顺序并不重要,但是版本2.2.3不喜欢它
$('#calendar').fullCalendar({
editable: false,
eventSources: [
{
url: '@Url.Action("PullCalendarEvents")',
type: 'POST',
error: function () {
//alert('there was an error while fetching events!');
presentErrorPopup('fetch');
}
}
]
});
//Moving this section to be below the above code resolved the error
$(function () {
$("#tabs").tabs({
show: function (event, ui) {
$('#calendar').fullCalendar('render');
}
})
});
在我的例子中,分号缺失是原因 类型错误:rangeStart为null,或者如果缩小,则A为null:
var reloadCalendar = function()
{
$('#calendar').fullCalendar('refetchEvents');
}
(function()
{
...
})();
无错误:
这可能会有所帮助。这纯粹是JavaScript,与C无关。我相应地更新了标记。没错,代码是JavaScript,但我在C应用程序中使用它。你为此给了它一个-不,我没有投反对票。刚刚编辑了你的标签。
var reloadCalendar = function()
{
$('#calendar').fullCalendar('refetchEvents');
}
(function()
{
...
})();
var reloadCalendar = function()
{
$('#calendar').fullCalendar('refetchEvents');
};
(function()
{
...
})();