Rajbir Singh
Rajbir Singh

Reputation: 1691

jQuery Full Calendar Default View Setting

I am using jQuery Full calendar.

But I am not getting how to set the week view as Default view in full calendar.

Upvotes: 18

Views: 49685

Answers (8)

mnk
mnk

Reputation: 1

$("#calendar").fullCalendar({
      initialView: 'timeGridWeek',
      ...
});

https://fullcalendar.io/docs/initialView

work for me in ver 5.11.0

Upvotes: 0

rstephen
rstephen

Reputation: 19

headerToolbar: {
    left: 'prev,next today',
    center: 'title',
    right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek'
},
initialView: 'timeGridWeek',

With newer version defaultView will not work, try initialView, make sure the value matches the options listed under your headerToolbar.

Upvotes: 1

Vahap Gencdal
Vahap Gencdal

Reputation: 2055

in v5 is initialView: 'timeGridWeek'

Upvotes: 3

wastetime909
wastetime909

Reputation: 1342

As for Version 4, use

defaultView: 'timeGridWeek',

or

defaultView: 'dayGridWeek',

reference: https://fullcalendar.io/docs/defaultView

Upvotes: 0

lin
lin

Reputation: 173

To get a calendar with a view of the week and hours:

$('#calendar').fullCalendar({
    defaultView: 'agendaWeek'
});

Upvotes: 2

ManiMuthuPandi
ManiMuthuPandi

Reputation: 1604

Try this agendaWeek

$('#calendar').fullCalendar({
theme: true,
header: {
left: 'prev,today,next',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultView: 'agendaWeek',
.....
})

Upvotes: 1

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100175

Try:


$('#calendar').fullCalendar({
    defaultView: 'basicWeek'
    aspectRatio: 1.5
});

Ref: FullCalendar Available Views

Edited:


$('#calendar').fullCalendar({
    header: {
        left: 'prev,next today',
        center: 'title',
        right: 'month,basicWeek,basicDay'
    },
    defaultView: 'basicWeek'
....

Upvotes: 42

Didier Ghys
Didier Ghys

Reputation: 30666

Use the defaultView option:

$('#myCalendar'-.fullcalendar({
     defaultView: 'basicWeek'
})

Upvotes: 3

Related Questions