211
Views
8
Comments
[FullCalendar 2] how to get current view in the fullcalendar2
Question
fullcalendar-2
Web icon
Forge asset by João Grazina

Hi

I am trying to get the current view of the fullcalendar.

in the javascript I have given code as


"var view = FullCalendar('getView');
alert(view.title);"


but its giving the error like "
An exception occurred in the client script. Error: FullCalendar is not a function".

can anyone help on this.

Thanks

Srinivas Nalamati

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi Srinivas,

I think it needs to be fullCalendar (staring with lower character f).

JavaScript is case sensitive.

Regards,

Daniel

UserImage.jpg
Srinivas Nalamati

Daniël Kuhlmann wrote:

Hi Srinivas,

I think it needs to be fullCalendar (staring with lower character f).

JavaScript is case sensitive.

Regards,

Daniel

Hi Danier,

I tried with the small letter also. I am getting the following error


"An exception occurred in the client script. Error: fullCalendar is not defined"


Thanks

Srinivas Nalamati


UserImage.jpg
Daniel Filipe

Hi Srinivas,


Try this:


OSFullCalendarInstance.calendar.view.type

UserImage.jpg
Srinivas Nalamati

Daniel Filipe wrote:

Hi Srinivas,


Try this:


OSFullCalendarInstance.calendar.view.type

Hi Daniel,

this works for me. Thank you.

now can I set this view name to "defaultview" or is there any attribute like to change the view through this java script.

My problem is

when I perform some action in the week/day view , after refresh the page goes to the month view as I set defaultview as month view.

now I am trying to get the viewname from the dayview/weekview and then I am trying to set that view name to default view. so to keep the current view after refresh.

any suggestions on this

Thanks

Srinivas Nalamati


UserImage.jpg
Srinivas Nalamati

Daniel Filipe wrote:

Hi Srinivas,


Try this:


OSFullCalendarInstance.calendar.view.type

Hi Daniel,

this works for me. Thank you.

now can I set this view name to "defaultview" or is there any attribute like to change the view through this java script.

My problem is

when I perform some action in the week/day view , after refresh the page goes to the month view as I set defaultview as month view.

now I am trying to get the viewname from the dayview/weekview and then I am trying to set that view name to default view. so to keep the current view after refresh.

any suggestions on this

Thanks

Srinivas Nalamati


UserImage.jpg
Srinivas Nalamati

in the advancedconfig of fullcalendar my javascript code is


defaultView: (OSFullCalendarInstance.calendar.view.type !== null ? OSFullCalendarInstance.calendar.view.type : 'dayGridMonth'),

But this is not working.

any other option for the above.


Thanks

Srinivas Nalamati

2018-05-30 16-28-55
Gopinath Reddy Reddigari

Hi Srinivas,

To maintain the default view state whenever the view changes (for example a day view or week view or month view is clicked) I have added an event listener for this and storing the value of view we get in a local variable. This helps us to have the latest view in local variable whenever the view type changes. I want to see if others have any ideas. 

UserImage.jpg
Srinivas Nalamati

Gopi Nath wrote:

Hi Srinivas,

To maintain the default view state whenever the view changes (for example a day view or week view or month view is clicked) I have added an event listener for this and storing the value of view we get in a local variable. This helps us to have the latest view in local variable whenever the view type changes. I want to see if others have any ideas. 


Hi Gopinath,

the local variables/session variables are not accessible from the javascript and vice versa. in this scenario how can i retrieve the value of a local variable which is assigned in the script.

Thanks

Srinivas Nalamati


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.