Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FullCalendar "view" cacheable

I am wondering if there is an option that i'm missing within FullCalendar.

I currently have the default view to be 'month'. But what I would like to happen is have it that IF the user views the "week" view, that the next time the user visits the website that the "week" view will show instead of the month. I am wondering about setting this out without using a DB.

I know jQuery UI Tabs has this ability using the 'cache' feature... is this something I can implement here as well? If so, how?

Any direction would be appreciative.

like image 585
Justin Avatar asked Dec 21 '22 14:12

Justin


2 Answers

changeView doesn't work, as viewDisplay is called before it when the calendar is setup.

here's what works:

in the initializing object, add:

defaultView: $.cookie('fullcalendar_defaultView') || 'month',

viewDisplay: function(view) { $.cookie('fullcalendar_defaultView', view.name); }
like image 114
Neil McGuigan Avatar answered Dec 26 '22 21:12

Neil McGuigan


You can store this setting in a cookie using jQuery.cookie which is the library that the Tabs uses. How you handle this and where it is setup is more of a question that you need to answer, since you provided no code.

like image 44
Nick Berardi Avatar answered Dec 26 '22 22:12

Nick Berardi