2013-04-29 69 views
0

我使用Fullcalendar從http://arshaw.com/fullcalendar/,我有搜索stackoverflow,但沒有answear適合我的問題,或者我沒有理解。如果這已經是answear,請粘貼鏈接。Fullcalendar議程視圖和日事件不會在特定時間內呈現事件(小時)

我有一個返回事件的XML文件:

事件例如:

<event allDay="false" editable="true" end="Mon Apr 29 2013 15:30:00 GMT+0100" id="53" start="Mon Apr 29 2013 08:30:00 GMT+0100" title="tesete"/> 
如果你注意到的開始和結束日

,時間格式保存這個樣子。

當我取的事件,像這樣:

events: function(start, end, callback) { 
      $.ajax({ 
       type: 'POST', 
       url: url, 
       dataType:'xml', 
       crossDomain: true, 
       data: { 
        // our hypothetical feed requires UNIX timestamps 
        start: Math.round(start.getTime()/1000), 
        end: Math.round(end.getTime()/1000),      
        'ajax':true, 
        'acc':'2',      
       }, 
       success: function(doc) {        
        var events = []; 
        $(doc).find('event').each(function() 
        { 
         events.push({ 
          id: $(this).attr('id'), 
          title: $(this).attr('title'), 
          start: $(this).attr('start'), 
          end: $(this).attr('end'), 
          allDay: $(this).attr('allDay'), 
          editable: $(this).attr('editable') 
         });        
        });          
        callback(events); 
       } 
      });  
     }, 

所有事件在月視圖中顯示正常,但是當我切換到agendaView或dayView,該事件僅在阿迪酒吧,他們不在特定小時之間呈現。

start="Mon Apr 29 2013 08:30:00 GMT+0100" end="Mon Apr 29 2013 15:30:00 GMT+0100" id="53" 

從8:30到15:30例如

我在想什麼?

解決方案的問題:

events: function(start, end, callback) { 
      $.ajax({ 
       type: 'POST', 
       url: 'myurl', 
       dataType:'xml', 
       crossDomain: true, 
       data: { 
        // our hypothetical feed requires UNIX timestamps 
        start: Math.round(start.getTime()/1000), 
        end: Math.round(end.getTime()/1000),      
        'ajax':true, 
        'acc':'2',      
       }, 
       success: function(doc) {        
        var events = []; 
        var allday = null; //Workaround 
        $(doc).find('event').each(function() 
        {    

         if($(this).attr('allDay') == "false") //Workaround 
           allday = false; //Workaround 
         if($(this).attr('allDay') == "true") //Workaround 
           allday = true; //Workaround       

         events.push({ 
          id: $(this).attr('id'), 
          title: $(this).attr('title'), 
          start: $(this).attr('start'), 
          end: $(this).attr('end'),      
          allDay: allday, 
          editable: $(this).attr('editable') 
         });        
        });          
        callback(events); 
       } 
      });  
     }, 

回答

0

瓦爾阿迪不能是一個字符串。它應該是allDay=false沒有引號

+0

是的,但這是一個xml文件中的事件,因此屬性值必須在引號中才能成爲一個值。 – 2013-04-29 13:03:50

+0

我想問題在於保存的日期格式。 – 2013-04-29 13:04:27

+0

你對我的朋友很感謝,謝謝:),對不起,因爲你是dumm :) 這裏實際上也是awnseared: http://stackoverflow.com/questions/9933373/formatting-events-date-and-time- on-fullcalender – 2013-04-29 13:32:40

相關問題