[FullCalendar 2] default week label date fomat,  default view to sessionVar

[FullCalendar 2] default week label date fomat,  default view to sessionVar

  
Forge Component
(13)
Published on 2016-03-23 by Grazina
13 votes
Published on 2016-03-23 by Grazina

Hi, i need to solve 2 issues:
1 - I have to change default week label date fomat
2 - when calendar is reloaded  it loose the default view, so i used a session var to manage it.
when I change the view by fulllcalendarButtons i don't know how to trigger the event and pass the new value to mysessionvar 


thanks for your help

Marinella

Solution

Hello Marinella,

Regarding FullCalendar, the first resource for you will always be FullCalendar's web page: https://fullcalendar.io/

To do what you wants, you need to configure the calendar (and use a little of JavaScript)

1. You need to provide the following JSON values in the Calendar's TextTimeCustomizationJSON property:

"views: {
        month: {columnFormat: 'ddd'}, 
        week: {columnFormat: 'ddd d MMM'}, 
        day: {columnFormat: 'ddd d MMM' }
},
dayNamesShort:['Dom','Seg','Ter','Qua','Qui','Sex','Sab']"

I have added the dayNamesShort to change the short names of the days (something it seems you already did).

2. Here, as far as I know, you need to do some JavaScript. First, I created a hidden input and button. the input will store the name of the view, while the button will execute an Ajax Submit to a Screen Action when the calendar executes the callback I add to the configuration:

"viewRender:function(view,element){
    $('#" + Input1.Id + "').val(view.name);
    $('#" + Button1.Id + "').click();
},

header: {
        left: 'prev,next today',
        center: 'title',
        right: 'month,agendaWeek,agendaDay'
},

theme: false,
firstDay: 0,
isRTL: false,
weekends: false,
fixedWeekCount: false,
weekNumbers:false,
height: 'auto',
contentHeight:'auto',
aspectRatio:'1.35',
eventLimit:'True'"

The second part after the viewRender property is just the default values of the Calendar's property you have to set this: GeneralDisplayJSON.

I attached an example you can use to study and adapt.

Cheers,
Eduardo Jauch

Solution

it works perfectly well,
grazie mille!


Marinella