Fullcalendar does not display the event according to schedule

Asked

Viewed 283 times

3

I’m working on a project with Fullcalendar, and I’m not being able to show the events correctly in their respective schedules. I feed the calendar with a Json (PHP system):

[
   {
      "id":"13",
      "title":"Varredura no sistema - Verificar falhas e consert\u00e1-las",
      "start":"2017-05-04",
      "end":"2017-05-07",
      "allDay":"true",
      "className":"evento"
   },
   {
      "id":"16",
      "title":"Teste",
      "start":"2017-06-02",
      "end":"2017-06-02",
      "allDay":"false",
      "className":"evento"
   },
   {
      "id":"17",
      "title":"Teste com hor\u00e1rio",
      "start":"2017-06-09T10:30:00",
      "end":"2017-06-09T11:30:00",
      "allDay":"false",
      "className":"evento"
   }
]

I have read and reread the documentation and can not understand where the problem is so that the event is not shown at the correct time! Only events with duration "allDay" appear in the correct line.

Can someone give me a light?! Gratitude, from now on! Aparecendo assim...

  • "id":"16" is out of time so it’s all day, check if JSON isn’t breaking because of "id":"17" accentuation seems to me to have accentuation.

  • @HENRIQUELOBO, I removed the accent and continues to mark as a whole day, including events with hours. =(

  • After you set up the array you are converting to JSON ? echo json_encode(name_array);

  • Exactly that! foreach($Row as $key => $value) { if (is_string($key)) { // Create an array with the field name // as key (Key) and the value (Value). $Fields[mysql_field_name($table,$i++)] = utf8_encode($value); } } // $json_result is the array you will receive // the values of the $Fields $json_result[ ] = $Fields ; } $JSON = json_encode($json_result); print_r($JSON);`

  • Try echo json_encode($json_result); instead $JSON = json_encode($json_result); print_r($JSON);`

1 answer

1


Example of how to mount the array to then return to JSON literal Object:

foreach ($aAgenda as $k => $v) {    
 $dados[] = array('id'    => $v->id,
                  'title' => $v->title,
                  'start' => $v->start,
                  'end'   => $v->end);
}
echo json_encode($dados);

Do this test and check if it will appear right on the calendar, comments the foreach and put that code:

 $dados[] = array('id'    => 1,
                  'title' => 'Teste',
                  'start' => '2017-06-23 12:30:00',
                  'end'   => '2017-06-23 13:30:00',);

echo json_encode($dados);
  • I did so and the result remains the same... The event that has time continues loading in the event line of the "Whole day"... =( I don’t know where else to touch...

  • @Wanessamarques what version of your Fullcalendar?

  • Fullcalendar v1.6.4 - old.... but I will update the version now...

  • I changed the version and it worked correctly! I had not even called me who was with the older version. Thank you so much for the help and patience!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.