I’m not getting the Fullcalendar V4 id

Asked

Viewed 38 times

0

I’m not getting the values when I click on the commitment. I always get "Undefined" Can anyone tell me what I’m doing wrong.? Thank you very much.

I made this example in CODEPEN in case someone wants to see the problem live. https://codepen.io/egameiro/pen/Rwbgemx

See below my code.

var calendarEl = document.getElementById('calendar');

var calendar = new FullCalendar.Calendar(calendarEl, {
  plugins: ['interaction', 'dayGrid', 'timeGrid'],
  defaultView: 'dayGridMonth',

  locale: 'pt-br',
  header: {
    left: 'prev,next today',
    center: 'title',
    right: 'dayGridMonth,timeGridWeek,timeGridDay'
  },
  navLinks: true, // can click day/week names to navigate views
  selectable: true,
  selectHelper: true,
  //selectMirror: true,
  editable: true,
  eventLimit: true, // allow "more" link when too many events

  //events: event1,
  events: [{
    id: '10',
    title: 'Meeting',
    start: '2019-08-01T10:30:00',
    end: '2019-08-01T12:30:00'
  }],

  eventClick: function (event) {
    alert(event.id);
    alert(event.title);
    alert(event.start.format('DD/MM/YYYY HH:mm:ss'));
    return false;
  },



});

calendar.render();

1 answer

0

Hello, to work you need to remove quotes from id, just like in the example :

  events: [{
    id: 10,
    title: 'Meeting',
    start: '2019-08-01T10:30:00',
    end: '2019-08-01T12:30:00'
  }]

Browser other questions tagged

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