Get / Set FullCalendar Options Dynamically

0
0

Hi,

I’m using the FullCalendar extension, now I would like to use JavaScript to get the FullCalendar options (cf. https://fullcalendar.io/docs/utilities/dynamic_options/).

The problem I’m having is I can’t get the Wisej FullCalendar extension option like this :

jQuery(“.fc”).eq(0).fullCalendar(“option”, “locale”);

I have the message : Attempting to call a FullCalendar method on an element with no calendar.

Any suggestions for how to fix this?

Thanks in advance!

Best regards

  • You must to post comments
0
0

Hi Luca,

i have to set 24 hour format for FullCalendar (AgendaView).

 

I found this (https://fullcalendar.io/docs/timeFormat), but right now i can’t set any options for this extension (see image).

 

Any suggestion ? Thanks

Attachment
  • You must to post comments
0
0

It works with :

var calendar1 = widget(jQuery(“div[name=’fullCalendar1′]”)[0]);

var locale = calendar1.calendar.option(“locale”);

Thanks!

  • You must to post comments
1
0

The Wisej extension uses the Calendar class to create the calendar and save the reference. Otherwise it would have to go through the jquery wrapper all the times.  When jquery calls $(“.fc”).fullCalendar(‘option’, ‘locale’) it first retrieves the element (or elements) with the class “fc” by name, then tries to retrieve the data using the name “fullCalendar” (same as $(“.fc”).data(“fullCalendar”)) then it looks for the function named “options”. There is also the problem of having more than 1 calendar in the same browser page, using “.fc” in jquery operates on all the calendars at once.

Since the widget has already created the full calendar and it needs to interact with the options dynamically, we create the full calendar class and save it in this.calendar. So you can:

this.calendar.option(“locale”) // if the script is running in the context of the wisej widget and this == wisej widget.

or:

App.Window1.fullCalendar1.calendar.option(“locale”); // using the fully qualified path.

There are other ways to get to  the widget, but it all depends on the context. You can also use the id of the widget. In any case, the widget object has a field “calendar” which is an instance of the $.fullCalendar.Calendar class.

HTH

 

 

  • Luca (ITG)
    Forgot to add, in case you haven’t done it already, that the FullCalendar source has been updated too and it uses the latest full calendar js version.
  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.