Change Fullcalendar event source after render

后端 未结 4 1467
心在旅途
心在旅途 2020-11-30 07:08

I\'ve been using FullCalendar v1.5.3 for a MS SharePoint replacement.

I\'m trying to re-render the calendar event\'s source. For instance, when the page loads by def

4条回答
  •  余生分开走
    2020-11-30 07:33

    after two days I got it, this is my code:

        $("#search").on("keypress", function(evt){
            if(evt.keyCode == 13) {
                var term = $(this).val();
                $.post(route_search, 
                                {
                                    term: term,
                                    async: false
                                },
                                function(data) {
                                    var parsed = $.parseJSON(data);
                                    $('#calendar').fullCalendar('removeEvents');
                                    $('#calendar').fullCalendar( 'addEventSource', parsed );
                                }
                );               
            }
        }); 
    

    There's a search input, when the user press enter key, an ajax post is sent to controller who returns an array os json values (events). (sorry about my poor english)

提交回复
热议问题