Tro*_*ino 9 javascript jquery fullcalendar backbone.js
我正在使用jQuery插件完整日历与backbone.js一起使用,并且遇到第一次加载时无法正常显示的问题.
这是包含日历的主干视图的渲染功能:
render: function() {
var that = this;
// DEBUG:
// console.log({entries: data});
this.$el.html(this.template(this.serialize()));
this.$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
height: that.$el.parent().height()
});
// prints undefined
console.log(this.$('#calendar').fullCalendar('getView').title);
window.setTimeout(function() {
this.$('#calendar').fullCalendar('changeView','agendaWeek');
}, 500);
return this;
}
Run Code Online (Sandbox Code Playgroud)
您可以看到我有500毫秒的设置超时.当我延迟500毫秒,然后将视图更改为agendaWeek时,它将显示.但是,如果我没有延迟,则日历不会显示.两种情况都没有打印错误.
我不知道在这里尝试什么或可能出错的地方.是否存在我在文档中某处缺少的日历创建回调?
谢谢
编辑:可能是.html()功能不完整并导致问题?
小智 12
我遇到了类似的问题,并在文档中发现了这些重要信息:
http://arshaw.com/fullcalendar/docs/display/render/
我的日历位于当前未选中的选项卡上,使父容器不可见,因此未正确绘制.选择选项卡后添加了对render方法的调用,这一切都很有效.
您的问题可能会以类似的方式解决.
| 归档时间: |
|
| 查看次数: |
12826 次 |
| 最近记录: |