2015-11-06 105 views
0

enter image description herefullcalendar当月

我有我的fullcalendar插件的问题,月视图在错误的一天显示事件。我目前正在尝试在日历的月视图中显示事件。当我在当前月份中时,一周中同一天的事件无法正确显示。他们将在同一周的星期日街区显示。正如你在图片中看到的那样,我正在挖掘'4'事件,它被写入13日,但在8日展示。即使是拖放,也知道它不在正确的位置,下面有灰色部分。这只是在当前月份发生。上次我参加我的项目时,是星期二,11月的星期二事件没有正确显示。

enter image description here

如果我进入再过一个月,每天都会正确显示。任何人有一个想法,为什么我目前的月份事件呈现这样?这是我的fullcalendar代码。我使用javascript和json编写了ASP.NET的事件呈现。

$('#calendar').fullCalendar({ 
     theme: true, 
     header: { 
      right: 'today prev,next', 
      left: 'title' 
     }, 
     defaultView: 'month', 
     eventClick: updateEvent, 
     selectable: true, 
     selectHelper: true, 
     select: selectDate, 
     timezone : 'local', 
     editable: true, 
     events: "../JsonResponse.ashx", 
     eventDrop: eventDropped, 
     eventResize: eventResized, 
     eventRender: function (event, element) { 
      //alert(event.title); 
      element.qtip({ 
       content: { 
        text: qTipText(event.start, event.end), 
        title: '<strong>' + event.title + '</strong>' 
       }, 
       position: { 
        my: 'bottom left', 
        at: 'top right' 
       }, 
       style: { classes: 'qtip-dark qtip-rounded' } 
      }); 

这是JSON数据呈现:

[{"id":27,"title":"2.5","start":"2015-11-28T00:00:00","end":"2015-11-29T00:00:00","allDay":true,"id_projet":68,"id_employe":1},{"id":43,"title":"5","start":"2015-11-18T00:00:00","end":"2015-11-19T00:00:00","allDay":true,"id_projet":68,"id_employe":1},{"id":44,"title":"5.6","start":"2015-12-03T00:00:00","end":"2015-12-04T00:00:00","allDay":true,"id_projet":68,"id_employe":1},{"id":45,"title":"8","start":"2015-11-12T00:00:00","end":"2015-11-13T00:00:00","allDay":true,"id_projet":68,"id_employe":1},{"id":46,"title":"5","start":"2015-11-16T00:00:00","end":"2015-11-17T00:00:00","allDay":true,"id_projet":68,"id_employe":1},{"id":47,"title":"9","start":"2015-11-27T00:00:00","end":"2015-11-28T00:00:00","allDay":true,"id_projet":68,"id_employe":1},{"id":55,"title":"1","start":"2015-11-06T00:00:00","end":"2015-11-07T00:00:00","allDay":true,"id_projet":68,"id_employe":1},{"id":56,"title":"7","start":"2015-11-29T00:00:00","end":"2015-11-30T00:00:00","allDay":true,"id_projet":68,"id_employe":1}] 

这是为了使事件列表功能:

public void ProcessRequest(HttpContext context) 
    { 
     context.Response.ContentType = "text/plain"; 

     // FullCalendar 2.x 
     DateTime start = Convert.ToDateTime(context.Request.QueryString["start"]); 
     DateTime end = Convert.ToDateTime(context.Request.QueryString["end"]); 
     int id_employe = Int32.Parse(context.Session["id_employe"].ToString()); 
     int id_projet = Int32.Parse(context.Session["id_projet"].ToString()); 


     List<int> idList = new List<int>(); 
     List<ImproperCalendarEvent> tasksList = new List<ImproperCalendarEvent>(); 

     //Generate JSON serializable events 
     foreach (CalendarEvent cevent in EventDAO.getEvents(start, end, id_projet, id_employe)) 
     { 
      tasksList.Add(new ImproperCalendarEvent 
      { 
       id = cevent.id, 
       title = cevent.title, 
       id_projet = cevent.id_projet, 
       id_employe = cevent.id_employe, 

       // FullCalendar 2.x 
       start = String.Format("{0:s}", cevent.start), 
       end = String.Format("{0:s}", cevent.end), 
       allDay = true, 
      } 
       ); 

       idList.Add(cevent.id);  

     } 

     context.Session["idList"] = idList; 

     //Serialize events to string 
     System.Web.Script.Serialization.JavaScriptSerializer oSerializer = new System.Web.Script.Serialization.JavaScriptSerializer(); 
     string sJSON = oSerializer.Serialize(tasksList); 

     //Write JSON to response object 
     context.Response.Write(sJSON); 
    } 
+0

它似乎并没有因为我加入了时区是一个时区的问题:“本地”,并没有解决问题。 – pikkkura

+0

没有足够的代码来确定原因,请问您如何确定事件的日期以及如何将所述日期传递到完整日历?将旅行,但我会检查这个问题整个晚上,如果你更新它。肠道反应是JS在本月错误1个错误,因为将C#DateTime转换为js日期非常挑剔。 –

+0

是的,我会用我的json数据和json事件渲染函数进行更新。谢谢 – pikkkura

回答

1

我已经能够解决这个问题,通过注释的代码在fullcalendar.js代码中。星期五的活动现在显示在星期五专栏中。虽然,我不相信这是最好的解决方案。

enter image description here

enter image description here

+0

这个问题似乎是在我的jQuery中,因为“ui-state-highlight”是需要评论的工作。 – pikkkura

+0

非常感谢,我确定你救了我几个小时:) – Rony