jquery cfajaxproxy fullcalendar pass start and end dates

490 views Asked by At

I am using FullCalendar (1.5.2), jQuery (1.8.1), but the older ColdFusion 8.

The issue I am having is how to properly pass the start and end dates for the current calendar month to a cfc using proxy.

The calendar displays, however, the json results do not display. I suspect it is how the start and end dates should be passed to the proxy entry.

Here is the code snippet.

<cfajaxproxy cfc="xxx.ScheduleEvents" jsclassname = "schEvents">
<script type="text/javascript">
  var date = new Date();
  var d = date.getDate();
  var m = date.getMonth();
  var y = date.getFullYear();
  var jEvents = new schEvents();

  jQuery('#calendar').fullCalendar({
    header:  {
        left:  'prev,next today',
        center:  'title',
        right:  'month, basicWeek, basicDay'
     },
     editable:  true,
     events:  jEvents.getEvents()
      });
   });
</script>

I have tested the function and it works using cfinvoke and createobject, returning correct information in the correct json format for fullcalendar. The only issue that I have is how is start and end passed to the cfc in this aspect. Am I to place it as params in () for getEvents or what?

Any help would be greatly appreciated.

1

There are 1 answers

3
emeier On

I haven't used cfajaxproxy, but whenever you are serializing to JSON you need to watch out for case sensitivity.

<cfset event.id = 4 />
<cfset event["title"] = "something" />

Once that is serialized to JSON, it becomes event.ID and event.title, i.e. using dot notation on structs, all the keys end up being upper cased.

I certainly remember running into that issue when I worked with that plugin and I also remember having to javaCast something to an int, but I don't know if that is still the case with that plugin.