4

I am trying to use the Full Calendar component to show 3 days in agenda Day view or eventually using the vertical resource view.

I tried using the example custom view but no luck.

Is it possible to show 3 days, one below another in the day view ?

I am using this constructor, but I don't want the days to be next to each other, but underneath each other.

$('#calendar').fullCalendar({
      defaultView: 'agendaDay',
      defaultDate: '2017-12-07',
      editable: true,
      selectable: true,
      eventLimit: true, // allow "more" link when too many events
      header: {
        left: 'prev,next today',
        center: 'title',
        right: 'agendaDay,agendaTwoDay,agendaWeek,month'
      },
      views: {
        agendaTwoDay: {
          type: 'agenda',
          duration: { days: 3 },

          // 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
          groupByDate: true
        }
      }
Vlad N
  • 631
  • 2
  • 10
  • 21

3 Answers3

2

You can't show the days below each other in an agenda style view, no. Its whole layout scheme is oriented horizontally. You can easily show them side-by-side, in the normal agenda style.

The vertical resource view provided by the Scheduler plug-in is essentially the same as the agenda view, but with each day split out into sub-columns for each specified Resource.

If you want days to appear one below the other, your only option is the "list"-style view. This will show things vertically, but you lose the time grid.

This code will achieve both of those types of view with a 3-day span, so you can see the difference:

views: {
  agendaThreeDay: {
    type: 'agenda',
    duration: {
      days: 3
    },
    buttonText: '3 day agenda'
  },
  listThreeDay: {
    type: 'list',
    duration: {
      days: 3
    },
    buttonText: '3 day list'
  }
},

Here is a working demo: http://jsfiddle.net/sbxpv25p/104/

If neither of those satisfy what you want, then your only other option is to make a completely custom view type (see the second half of this documentation page: https://fullcalendar.io/docs/views/Custom_Views/). This is a complex and time-consuming task, so before embarking on such a thing you should consider whether one of the built-in types of view will really be satisfactory - they do convey the necessary information to the user, which is the main purpose of a calendar, even if it wasn't quite in exactly the layout you had imagined.

ADyson
  • 57,178
  • 14
  • 51
  • 63
  • I managed to show the days below each other in agenda style view :) All you have to do is something like this YourView: {type: 'agendaDay', minTime: '-24:00:00', maxTime: '36:00:00', slotDuration: '00:30:00', } This way you get more than one day in your view. I think you can add as many days + / - as needed. – Vlad N Feb 19 '18 at 08:04
  • 1
    @VladN that's very interesting and might be useful to others. You should write it as an answer. – ADyson Feb 19 '18 at 09:26
2

In order to show multiple days in Agenda View ( Day ) just add - and + how many hours you want ... For example -24 H for a day ahead and +24 H for a day after your selected day. Something like this:

  views: {

    firstView: {
      type: 'agendaDay',
      minTime: '-12:00:00',
    maxTime: '36:00:00',
    slotDuration: '00:30:00',
            },

  }
Vlad N
  • 631
  • 2
  • 10
  • 21
0
views: {
      timeGridFourDay: {
        type: 'timeGrid',
        duration: { days: 4 },
        buttonText: '4 day'
      }
    },

and add it to header:

header: {
      left: 'prev,next',
      center: 'title',
      right: '.....,timeGridFourDay'
    },

https://fullcalendar.io/docs/custom-views

Govar
  • 105
  • 1
  • 10