Fullcalendar C#

Asked

Viewed 404 times

1

I would like to open a modal when clicked on a day in the calendar.

script:

<script>
    $(document).ready(function ()
    {
        $('#calendar').fullCalendar({
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,listWeek'
            },
            views: {
                listWeek: { buttonText: 'Compromissos' }
            },
            defaultView: 'month',
            defaultDate:  '@(ViewBag.HoraHoje)',
            navLinks: false, // can click day/week names to navigate views
            editable: false,
            eventLimit: false, // allow "more" link when too many event
            selectable: true,
            dayClick: function(date, jsEvent, view, resourceObj) {
                $('#id01').dialog();
}
        });

    });
</script>

html:

    <body>
<div id="calendar"></div> 
<div id="id01" class="w3-modal">
    <div class="w3-modal-content">
        <div class="w3-container">
            <p>Some text. Some text. Some text.</p>
            <p>Some text. Some text. Some text.</p>
        </div>
    </div>
</div>

1 answer

0


According to the documentation in: dayClick

$('#calendar').fullCalendar({
dayClick: function(date, jsEvent, view, resourceObj) {

    alert('Date: ' + date.format());
    alert('Resource ID: ' + resourceObj.id);

    }
});

in place of alert you can put your modal:

$('#seuModal').dialog(); //por exemplo
  • Still not getting it.

  • When you open the Developer Tools, in Console some error appears?

  • The method does not work

  • What is the name of the method?

  • Got . took a look at the bootstrap site

Browser other questions tagged

You are not signed in. Login or sign up in order to post.