0
I’m getting the following error, could help me ?
Uncaught TypeError: e.map is not a function
at t.setResources (scheduler.min.js:8)
at scheduler.min.js:8
at scheduler.min.js:8
at cal-init.js:218
at Object.success (cal-init.js:184)
at i (jquery-3.2.0.min.js:3)
at Object.fireWith [as resolveWith] (jquery-3.2.0.min.js:3)
at A (jquery-3.2.0.min.js:10)
at XMLHttpRequest.<anonymous> (jquery-3.2.0.min.js:10)
Code:
var resources = 'students';
function getResources(handleData) {
$.ajax({
method: "POST",
url: "/Schedule/GetAllEmployeeJsonAsync",
dataType: "json",
data: {
'data': resources
},
success: function (data) {
handleData(data);
}
});
}
$this.$scheduleObj = $this.$schedule.fullCalendar({
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
slotDuration: '00:15:00', /* Se quisermos dividir o tempo do dia a cada 15 minutos */
defaultView: 'agendaDay',
aspectRatio: 1.5,
scrollTime: '00:00',
header: {
left: 'prev,next today',
center: 'title',
right: 'agendaDay,agendaTwoDay,agendaWeek,month'
},
views: {
agendaTwoDay: {
type: 'agenda',
duration: { days: 2 },
// views that are more than a day will NOT do this behavior by default
// so, we need to explicitly enable it
groupByResource: true
//// uncomment this line to group by day FIRST with resources underneath
//groupByDateAndResource: true
}
},
//// uncomment this line to hide the all-day slot
//allDaySlot: false,
resources: function(callback) {
getResources(function (resourceObjects) {
callback(resourceObjects);
});
},
events: [
{ id: '1', resourceId: 'a', start: '2018-04-06', end: '2018-04-08', title: 'event 1' },
{ id: '2', resourceId: 'a', start: '2018-04-07T09:00:00', end: '2018-04-07T14:00:00', title: 'event 2' },
{ id: '3', resourceId: 'b', start: '2018-04-07T12:00:00', end: '2018-04-08T06:00:00', title: 'event 3' },
{ id: '4', resourceId: 'c', start: '2018-04-07T07:30:00', end: '2018-04-07T09:30:00', title: 'event 4' },
{ id: '5', resourceId: 'd', start: '2018-04-07T10:00:00', end: '2018-04-07T15:00:00', title: 'event 5' }
],
editable: true,
droppable: true, // isso permite que as coisas caiam no calendário !!!
eventLimit: true, // permitir "mais" link quando muitos eventos
selectable: true,
drop: function (date) { $this.onDrop($(this), date); },
select: function (start, end, allDay) { $this.onSelect(start, end, allDay); },
eventClick: function (calEvent, jsEvent, view) { $this.onEventClick(calEvent, jsEvent, view); }
});
I’m returning a Json, and using:
function(callback) {
getResources(function (resourceObjects) {
callback(resourceObjects);
});
to insert the data into resource
I await return
No, but you posted the error instead of the code!!
– LeAndrade
Yes, in no time of my code do I use a call
map
, but even so is returning this error.– Matheus
Error comes from inside the library
scheduler
:(scheduler.min.js:8)
. You are possibly passing some wrong parameter.– Woss
can be by
function(callback) {
 getResources(function (resourceObjects) {
 callback(resourceObjects);
 });
 }
, but I need to somehow return from the database and put the data in the format of aJson
, inresource
– Matheus