0

開始日と終了日を含むリストがあります。JQuery AJAXを使用して取得しています。その日付を FullCalendar のイベントとして表示するにはどうすればよいでしょうか。

リストからデータを取得するためのコード

   var soapEnv =
        "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
            <soapenv:Body> \
                 <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                    <listName>BatchSchedule</listName> \
                    <viewFields> \
                        <ViewFields> \
                           <FieldRef Name='BatchId' /> \
                           <FieldRef Name='StartDt' /> \
                           <FieldRef Name='Enddt' /> \
                           <FieldRef Name='location' /> \
                        </ViewFields> \
                    </viewFields> \
                     <rowLimit>8500</rowLimit>\
                </GetListItems> \
            </soapenv:Body> \
        </soapenv:Envelope>";

    $.ajax({
        url: "https://www.mysite.com/sites/Batch/_vti_bin/lists.asmx",
        type: "POST",
        dataType: "xml",
        data: soapEnv,
        complete: processResult,
        contentType: "text/xml; charset=\"utf-8\""
    }); // end ajax function

  function processResult(xData, status) 
  {
     $(xData.responseXML).find("z\\:row").each(function() {});
  }

昨日書いた完全なコードですが、望ましい結果が得られません

    function getbatchdetails(loc){ //loc - passing location as parameter
var soapEnv =
            "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
                <soapenv:Body> \
                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                        <listName>batch</listName> \
                        <viewFields> \
                            <ViewFields> \
                               <FieldRef Name='BatchId' /> \
                               <FieldRef Name='StartDt' /> \
                               <FieldRef Name='Enddt' /> \
                               <FieldRef Name='location' /> \
                               <FieldRef Name='ID' /> \
                            </ViewFields> \
                        </viewFields> \
                         <rowLimit>500</rowLimit>\
                    </GetListItems> \
                </soapenv:Body> \
            </soapenv:Envelope>";

        $.ajax({
            url: "https://www.mysite.com/sites/Batch/_vti_bin/lists.asmx",
            type: "POST",
            dataType: "xml",
            data: soapEnv,
            complete: processResult,
            contentType: "text/xml; charset=\"utf-8\""
        }); // end ajax function
        function processResult(xData, status) 
        {
            $(xData.responseXML).find("z\\:row").each(function() { 
            var returnedloc = new String($(this).attr("ows_location"));
            if(loc==returnedloc){
                newEvent[0]=new String($(this).attr("ows_Title"));
                newEvent[1]=$(this).attr("ows_StartDt");
                newEvent[2]=$(this).attr("ows_Enddt");
                eventsArray.push(newEvent);
              }
            });//responseXML
        var nextEvent = [];
        for (var k=0;k<eventsArray.length;k++){
            nextEvent.push ({
                title: eventsArray[k][0],
                start: eventsArray[k][1],
                end: eventsArray[k][2],
                allDay: false
            });
        }
        $('#calendar').fullCalendar({
            /*defaultView: 'year',
            year: 2012,
            header: {
                left: 'prev,next today',
                center: 'title',
                //right: 'year,month,agendaWeek,agendaDay'
                right: 'year,month'
            },*/
            editable: true,
            events: nextEvent,
            colour: 'blue'
        });       }//processResult
}//end of getBatch Details
4

1 に答える 1