完整的日历没有显示内部bootstrap模式 [英] Full calendar not showing inside bootstrap modal

查看:104
本文介绍了完整的日历没有显示内部bootstrap模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用bootstrap模式加载模态对话框。在其中我想显示一个fullcalendar(jquery one),上面有一些事件。我创建了我的模态,并放入完整的日历。但是当模态出现时,完整日历不会显示。但它显示在模态出现后我按下下一个或上一个按钮。但是日历上没有任何事件。 jsfiddle here
和代码

I want to load a modal dialog using bootstrap modal. Inside of it i want to show a fullcalendar (the jquery one) with some events on it. I have created my modal, and put inside the full calendar. But Full calendar won't show when modal appears. But it shows when after the modal has appeared i press on either next or previous buttons. But then no event appears on the calendar.jsfiddle here and code

<a href="#myModal" role="button" class="btn btn-default" data-toggle="modal">Launch demo modal</a>

<div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3 id="myModalLabel">Modal header</h3>
        </div>
        <div class="modal-body">
            <div class="row">
                <div class="col-xs-6">
                    <div id="calendar"></div>
                </div>
            </div>            
        </div>
        <div class="modal-footer">
            <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
            <button class="btn btn-primary">Save changes</button>
        </div>
    </div>
</div>

js

$("#calendar").fullCalendar({
    header:{
        left:'prev',
        center:'title',
        right:'next'
    },
    events:'/eventsfeed/',
    defaultView:'agendaDay'
});

这也会使事件不会出现在日历上。这是我/ eventsfeed返回的内容

That also make events not to appear on calendar. This is what my /eventsfeed is returning

[{"url": "/calendar/entry/223", "start": "2013-12-04T17:00:00Z", "end": "2013-10-04T16:45:00Z", "description": "a body", "title": "Title entry"}]

我在项目和事件的不同页面使用fullcalendar,一切正常呈现。

I use fullcalendar in different pages of my project and events and everything render normally.

如何在模态出现时加载

推荐答案

你应该试试这个:

$('#myModal').on('shown.bs.modal', function () {
   $("#calendar").fullCalendar('render');
});

这是你的小提琴:http://jsfiddle.net/mzAEj/2/

这是文档: http://arshaw.com/fullcalendar/docs/display/render/

这篇关于完整的日历没有显示内部bootstrap模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆