I’m using fullcalendar to create an agenda with teachers’ classes, but when entering the schedule screen the data does not appear (even though it was loaded in the request). When I change the week the data appears, but it is all at the end, after the calendar. Anyone knows why?
`items: [{region: 'center',xtype: 'panel',html: '<div id="calendar"></div>',listeners: {render: function() {var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, { plugins: ['bootstrap', 'interaction', 'dayGrid', 'timeGrid'], locale: 'pt-br', themeSystem: 'standard', titleFormat: { year: 'numeric', month: 'numeric' }, header: { left: 'prev,next today', center: 'title', right: 'timeGridWeek,timeGridDay' }, dayMaxEvents: true, margin: '10', contentHeight: '550', defaultView: 'timeGridWeek', slotDuration: '00:15:00', slotLabelInterval: '00:15:00', allDaySlot: false, showNonCurrentDates: false, minTime: '07:00:00', maxTime: '18:00:00', firstDay: 1, events: function (info, successCallback, failureCallback) { Ext.Ajax.request({ url: sUrlContabil('public') + '?func=buscaGradeProf', method: 'POST', params: { codUnidade: codUnidade, codProf: codOrigem, ano: nbAno.getValue(), inicio: dtObsInicio.getValue(), fim: dtObsFim.getValue() }, success: function (response) { var dados = Ext.decode(response.responseText); let events = []; console.log(response.responseText); dados.results.forEach(function (grade) { // Partes do horário de início e fim let startTimeParts = grade.HORA.trim().split(':'); let endTimeParts = grade.HORAFIM.trim().split(' ')[1].split(':'); for (let dia = 1; dia <= 7; dia++) { if (grade[dia]) { let title = grade[dia].replace(/<brs*/?>/g, '').trim(); let eventStart = adjustDateToDayOfWeek(new Date(info.start), dia); let eventEnd = new Date(eventStart); eventStart.setHours(parseInt(startTimeParts[0]), parseInt(startTimeParts[1]), 0); eventEnd.setHours(parseInt(endTimeParts[0]), parseInt(endTimeParts[1]), 0); if (eventStart >= info.start && eventEnd <= info.end) { events.push({ title: title, start: eventStart.toISOString(), end: eventEnd.toISOString(), color: grade[`COR_${dia}`] || '#FFA500', allDay: false }); } console.log('eventos:',eventStart, eventEnd); console.log("Event Start:", eventStart.toISOString()); console.log("Event End:", eventEnd.toISOString()); } } }); successCallback(events); }, error: function() { failureCallback(); } }); } }); calendar.render(); } } }
],`
Data format:"HORA_DATA":"2024-01-26 07:00:00""HORAFIM":"2024-01-26 08:00:00""DATAINI":"01/02/2024""DATAFIM":"20/12/2024"
I already tried to first load the events and then call the calendar, but it didn’t work, the screen was blank.