Question

I am looking to implement the jQuery full calendar control as Keith Strickland was nice enough to demonstrate here. http://www.keithstric.com/A55BAC/keithstric.nsf/default.xsp?documentId=C4ACC1CA300C873786257B15007F7732

I am having problems with his method of using java to get the data. Could someone be willing to help me use another method to parse the data in a notes view or at least understand what is going on? I would prefer to use native REST control, or javascript if possible. Here is an example of my failed attempts to read the

I have a notes form and for simplicity sake I name the fields start, end, and title. My view has those fields which are the same fields that the full calendar is looking for. I thought I could just feed the full calendar the json data and it would be happy. Is this possible?

<xp:scriptBlock>
    <xp:this.value><![CDATA[var calCon = $("[id$=calendarContainer1]");
var urlVal = function() {
var baseUrl = location.href;
var restUrl = baseUrl.substring(0, baseUrl.indexOf(".xsp") +4);
restUrl = restUrl + "xRest";
return restUrl;
}
calCon.fullCalendar({
firstDay: 0,
header: {
    left: "prev,next today",
    center: "title",
    right: "month,basicWeek,basicDay"
},
disableDragging: true,
events: {
    url: urlVal(),
    type: "GET",
    error: function() {
        alert("something asploded");
    }
},
dayClick: function(date, allDay, jsEvent, view) {
    console.log("date=",date);
    console.log("allDay=",allDay);
    console.log("jsEvent=",jsEvent);
    console.log("view=",view);
}
});]]></xp:this.value>
</xp:scriptBlock>

Here is my jSOn

 {
  "@entryid":"2-99049B468C567FC3852577D20021A431",
  "@unid":"99049B468C567FC3852577D20021A431",
  "@noteid":"9AA",
  "@position":"2",
  "@siblings":539,
  "@form":"cp",
  "start":"2010-11-22T00:40:40Z",
  "end":"2010-11-22T00:40:40Z",
  "title":"Duncan, SC Office",
  "name":"username",
  "allday":"",
  "$4":"99049B468C567FC3852577D20021A431"
Was it helpful?

Solution

As I wrote in my comment above I'm missing a few details in your question. Nevertheless I guess it must be the restUrl variable that's causing trouble:

assuming that xRest is your rest service's pathInfo property, and referencing you source view name as yourView the url should be something like that:

restUrl = restUrl + "/xRest?viewname=yourView&start=0&end=1000";

Quoting my colleague who wrote that piece of code we couldn't get it to show any proper result unless we included some start and end arguments.

I see a few more differences between your code and ours but those probably wouldn't do any harm.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top