-
-
Save niladam/15ef23d2988b602bbad62eed93eba6cd to your computer and use it in GitHub Desktop.
FullCalendar remember selected View
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment