Add json event url in fullcalendar

Asked

Viewed 598 times

0

I’m using fullcalendar, nodejs and Mongoose. I’ve already managed to generate the json file. But when passing the path in the js of fullcalendar, I cannot recover the events.

I created a json test file and called it as follows:

 script(type='text/javascript'). 
    $(document).ready(function() {
      $('.calendar').fullCalendar( {
          header: {
            right: 'prev,next today,month,agendaWeek,agendaDay'
          },
          aspectRatio: 2,
          events: "/calendars.json"
      } );
    });

But it doesn’t work. I wanted to know how I can call the info of Mongoose and display in the calendar.

  • Welcome to Sopt, Nodejs. You said your code doesn’t work. But, what error is returned? Edith your question and add this and other information that you find relevant to solving the problem. I suggest reading on [tour] and [Ask].

  • already solved. Thank you!

  • What should that way be? That way calendarjson would be calendar.json? using events: "/calendars/calendarjson", as path to.json file

1 answer

1

solved: Obs: it is necessary to download js Qtip to add pop-up with events.

script(type='text/javascript').$(document).ready(function() {
      $('.calendar').fullCalendar({
        header: {
          right: 'prev,next today,month,agendaWeek,agendaDay'
        },
        events: "/calendars/calendarjson",//caminho arq. json
        eventRender: function(event, element)//abrir popup cm eventos {
          element.qtip({
            content: "" + event.flRoot+""+"<br/>" + "Cliente: " + event.client+""+"<br/>" + "Pauta: " + event.name+"", 
          });
        } 
      });
    });

Browser other questions tagged

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