Skip to main content
adicionou 3150 caracteres ao conteúdo
Fonte Link
Matheus
  • 609
  • 5
  • 23

Código:

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); }

    });

Estou retornando um Json, e utilizar:

function(callback) {
        getResources(function (resourceObjects) {
            callback(resourceObjects);
        });

para inserir os dados em resource

Aguardo retorno

Aguardo retorno

Código:

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); }

    });

Estou retornando um Json, e utilizar:

function(callback) {
        getResources(function (resourceObjects) {
            callback(resourceObjects);
        });

para inserir os dados em resource

Aguardo retorno

Fonte Link
Matheus
  • 609
  • 5
  • 23

Uncaught TypeError: e.map is not a function

Estou recebendo o seguinte erro, conseguiriam me auxiliar ?

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)

Aguardo retorno