Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
FullCalendar remember selected View
// Get defaultView from LocalStorage, fallback on basicWeek if it is not set yet.
var defaultView = (localStorage.getItem("fcDefaultView") !== null ? localStorage.getItem("fcDefaultView") : "basicWeek");
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
defaultView: defaultView,
viewRender: function (view, element) {
// When the view changes, we update our localStorage value with the new view name.
localStorage.setItem("fcDefaultView", view.name);
}
});
@okliv

This comment has been minimized.

Copy link

okliv commented Oct 22, 2019

for fc v.4+

viewSkeletonRender: function (info) {
  localStorage.setItem("fcDefaultView", info.view.type);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.