Monday, September 10, 2012

jquery fullcalendar reload events data


jQuery("#targetdiv").fullCalendar("refetchEvents");
jQuery('#targetdiv').fullCalendar("rerenderEvents");

This might be useful to others:

jQuery('#divCalendar').fullCalendar({
      header: {
        left: 'prev,next today',
        center: 'title',
        right: 'month,agendaWeek'
      },
      dayClick: function(date, allDay, jsEvent, view) {
        var sRawDate = date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate();
        var sDate = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear();
       
        var sDay = date.getDay();
        sDay = sDay == 0 ? 7: sDay;
        if (allDay) {
         
        }else{
          //jQuery("#frmClassAdd input[name=txtStartDate]").val(date);
          var sTime = date.getHours() + ":" + date.getMinutes();
        }
       
        // change the day's background color just for fun
        //$(this).css('background-color', 'red');
        //todo trigger add data
      },
      editable: true,
      firstDay: 1, //states monday as 1st day of week
      events: [
      ],
      eventSources: [
        {
          url: "url_to_data.php", //
          data: {
            groupid: 5, //some param to pass in on top of start
          }
        }
      ],
     
      eventClick: function(calEvent, jsEvent, view) {
        //todo show an event
        //console.log(calEvent);
      }

    });


No comments: