1

I am using Full Calendar with server-side processing.

PHP

while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
  $event_array = array();

  $event_array['id'] = $row['id'];
  $event_array['title'] = $row['forename'] "" $row['surname'];
  $event_array['start'] = $row['start'];
  $event_array['end'] = $row['end'];
  $event_array['allDay'] = true;
  $event_array['color'] = $row['colour'];
  $event_array['textColor'] = "white";

  array_push($return_array, $event_array);
}

Problem

The color and textColor values are not having an effect on the calendar. I have read http://fullcalendar.io/docs/event_data/events_array/ and these are both valid options but I am not sure if I am using them correctly in the array.

$row['colour'] is the row in the database storing the colour value such as black.

user3973427
  • 1,435
  • 3
  • 16
  • 20

2 Answers2

1

Solution

I used $event_array['className'] = $row['colour']; where row['colour'] returned for example black.

I then used:

.black div {
  background-color: black;
  border-color:     black;
  color:            white;
}

in CSS.

user3973427
  • 1,435
  • 3
  • 16
  • 20
0

use like this.

    eventRender: function(info) {
        if (moment(info.event.end) < moment()){
            info.el.style.backgroundColor  = "#e3e3e3";
            info.el.style.borderColor ="#e3e3e3";
        } else {
            info.el.style.backgroundColor  = "#6a49fc";
            info.el.style.borderColor ="#6a49fc";
            info.el.style.color = "#ffffff";
          }
      },