0

JSON url オプションを使用してjQuery Full Calendarプラグインを使用しようとしていますが、エラーは発生しませんが、イベントも表示されません。問題が何であるかを理解できません。

フル カレンダー コール:

$('#calendar').fullCalendar({                                                                                           
    aspectRatio: 1.3,                                                                                                                                                                                                                   
    defaultView: 'agendaWeek',                                                                                          
    slotMinutes: 15,                                                                                                    
    editable: true,                                                                                                     
    allDaySlot:false,                                                                                                   
    events: '/appt/appointments/json_event_source'                                                                                                                 
});

URL からの応答の例

[
  {
    "id": "2",
    "title": "Adrian Adams",
    "start": "1346339700",
    "end": "1346340600"
   },
   {
     "id": "3",
     "title": null,
     "start": "1346166000",
     "end": "1346169600"
   },
   {
     "id": "4",
     "title": "asdfEditeda asdf",
     "start": "1346335200",
     "end": "1346335200"
   },
   {
     "id": "5",
     "title": "asdfEditeda asdf",
     "start": "1346335200",
     "end": "1346335200"
   },
   {
     "id": "6",
     "title": "asdfEditeda asdf",
     "start": "1346335200",
     "end": "1346339700"
   }
]
4

1 に答える 1

0

イベント オブジェクトのtitle属性は必須であり、(2 番目のイベントのように) することはできませんnull。それを空の文字列に変更すると、カレンダーが正常に表示されました。

これを見てください: http://jsfiddle.net/100thGear/M8RRR/

タイトルのないオブジェクトを返さないように、サーバー側のコードに検証を追加することができます。

これが役立つかどうか教えてください!

于 2012-08-31T15:06:10.117 に答える