2012-05-23 90 views

回答

0
$('#external-events div.external-event').each(function() { 
     // store data so the calendar knows to render an event upon drop 
     $(this).data('event', { 
      title: $.trim($(this).text()), // use the element's text as the event title 
      stick: true // maintain when user navigates (see docs on the renderEvent method) 
     }); 
     // make the event draggable using jQuery UI 
     $(this).draggable({ 
      zIndex: 1111999, 
      revert: true,  // will cause the event to go back to its 
      revertDuration: 0 // original position after the drag 
     }); 
    }); 
    /* initialize the calendar 
    -----------------------------------------------------------------*/ 
    var date = new Date(); 
    var d = date.getDate(); 
    var m = date.getMonth(); 
    var y = date.getFullYear(); 
    $('#calendar').fullCalendar({ 
     header: { 
      left: 'prev,next today', 
      center: 'title', 
      right: 'month,agendaWeek' 
     }, 
     editable: true, 
     droppable: true, // this allows things to be dropped onto the calendar 
     drop: function() { 
      // is the "remove after drop" checkbox checked? 
      if ($('#drop-remove').is(':checked')) { 
       // if so, remove the element from the "Draggable Events" list 
       $(this).remove(); 
      } 
     }, 
     eventDrop: function(event, delta, revertFunc) { 
      alert(event.id); 
      $.ajax({ 
       type: "POST", 
       url: "${pageContext.request.contextPath}/task/periodic-task-update", 
       data : { 
        id : event.id , 
        date :event.start.format() 
       }, 
       success: function(data) { 
        if(data=='Task Period Succesfully Changed'){ 
         toastr.success("Task Period Succesfully Changed."); 
        }else{ 
         toastr.success("Something Wrong"); 
         revertFunc(); 
        } 
       }, 
       error: function(data,textStatus,xhr) { 
        toastr.success("Something Wrong"); 
        revertFunc(); 
       }  
      }); 
     }, 
     events: [ 
       <c:forEach var='periodicTask' items='${periodicTaskTemplates}'> 
        <c:forEach varStatus="i" begin = "1" end = "12"> 
         { id: '${periodicTask.id}', title: '${periodicTask.task}', start: new Date(y, '${i.index}', '${periodicTask.startDate}'), end: new Date(y, '${i.index}', '${periodicTask.lastDate}') ,type:'${periodicTask.description}',location:'${periodicTask.location.name}'}, 
        </c:forEach> 
       </c:forEach>` 
     ], 
    }); 
+0

這個函數實現jstl標籤庫 –

相關問題