How to find view of month, week or day in full calendar

I use the full calendar. here my question is how to find the complete calendar in the form of a month, week or day in the format when you click the "Previous" or "Next button". here I call the custom code for the back and forth buttons. because with this I want to run some user data. based on the fullcalendar view.

$(document).on('click', '.fc-button-next a span', function () { 

here I want to find a view of the full calendar, which is a month or a week or a day

  var abc = $("#calendar").fullCalendar('getView').start.toString(); var MonthVal = getMonthValue(abc); var YearVal = getYearValue(abc); $('#calendar').fullCalendar('destroy'); dataString = "{ID:" + MonthVal + "," + "year:" + YearVal + "}"; DisplayCalendarForMonth(dataString, MonthVal, YearVal); }); $(document).on('click', '.fc-button-today a span', function () { 

here I want to find a view of the full calendar, which is a month or a week or a day

  $('#calendar').fullCalendar('destroy'); DisplayCalendar(); }); 
+6
source share
4 answers
  var view = $('#calendar').fullCalendar('getView'); if (view.name == 'month') { } 
+8
source
 $('#calendar').fullCalendar({ viewDisplay: function(view) { alert('The new title of the view is ' + view.title); // view consist Available views // month, basicWeek,basicDay,agendaWeek,agendaDay } }); 
+1
source
  var view = $('#calendar').fullCalendar('getView'); alert("You have click on"+view.name); 

link to link: enter link description here

0
source
  var view = $('#calendar').fullCalendar('getView'); 

doesn't work for me, instead I use:

 var calendar = new FullCalendar.Calendar(document.getElementById('calendar'), { ... } console.log( calendar.view.type ); 

Printing on the console: dayGridMonth

0
source

Source: https://habr.com/ru/post/1487804/


All Articles