jquery fullcalendar send custom parameter and refresh calendar with JSON

前端 未结 11 1388
名媛妹妹
名媛妹妹 2020-12-23 12:14

im trying to use the jquery fullcalendar. The event data comes from the server using JSON. My page has a dropdown element and the fullcalendar div.

What i need is to

11条回答
  •  一向
    一向 (楼主)
    2020-12-23 12:23

    The problem is that you are changing the value of the dropdown after you have created the event object, which has a copy of the original value of the dropdown. The following is what you need:

    $('#dropdownId').change(function () {
        events.data.customParam = $(this).val();
        $('#calendar').fullCalendar('refetchEvents');
    });
    

    This relies on the event object being created in an area where it can be accessed from the dropdown onchange and the fullcalendar initialisation (e.g. document onload)

提交回复
热议问题