views:

350

answers:

0

I am adding events via a coldfusion cfc, that supplies the data, in correct format, I believe.

It successfully returns data, there are no javascript or jquery errors.

I have a function that get's the data, upon clicking on a list of possible sources of data, I wish to display in the calendar.

When I click it does load the data, but it does not appear anywhere in the calendar...

 function 
addEventSource(assigned_courses,available_classes,forums,blog) {
  // create feed url that can be used globally
  <cfoutput>
  var dataString = 'assigned_courses=' + assigned_courses + 
'&available_classes=' + available_classes + '&forums=' + forums + '&blog=' 
+ blog + '&company_id=#session.company_id#&user_id=#session.user_id#';
  </cfoutput>

  // do ajax call
  $.ajax({
   type: "GET",
   url: "/scripts/cfc/events.cfc?
method=controller&returnformat=json",
   data: dataString,
   success: function(response){

    // add ajax data to calendar events data 
object

$('#calendar').fullCalendar('renderEvent',response,true);

   }
  });

  // re-render after they are loaded
  $('#calendar').fullCalendar( 'refetchEvents' );

  // list events
  listEvents();
 }

I have tried to create a function that would list all the current events in memory, but it display's nothing...

 function listEvents() {
  // remove div if it exists
  $('#show_events').remove();

  // add div to inside calendar div
  $('#calendar').append("<div id='show_events'></div>");

  // add ul to div
  $('#show_events').append('<ul>');

  // list all events into the specific div
  var event = $('#calendar').fullCalendar('clientEvents');

  // loop thru array
  $.each(event, function(index, value) {

   // get title
   title = event[index];

   // get start
   start = event[start];

   // get end
   end = event[end];

   // add li element
   $('#show_events').append('<li>'+title+' ' + start + 
' to ' + end + '</li>');

  });

  // add ul to div
  $('#show_events').append('</ul>');


 }

How can i properly debug or diagnose what is wrong with the data being getted? Is there a better or easier way to display current event data?

Just to clarify I have two problems:

  1. Making sure AddEventSource is correctly getting correctly formatted data to be added to the Calendar Event Object

  2. To help diagnose the lack of anything appearing on the calendar, I need a way to see the current event data, in perhaps a list format.

Thank You.. alt text