Calendar View Drop-down not changing when chaning view via javascript

  • 1
  • Problem
  • Updated 2 years ago
  • Solved
I have some javascript code that that can change the calendar view programatically as follows:

CalendarObject = skuid.$('#CenterCalendar').data('object');
CalendarObject.currentView = 'month';
CalendarObject.refresh();

the refresh() redraws the calendar in month view when the code above runs.

I can do the same to change to week view:
CalendarObject = skuid.$('#CenterCalendar').data('object');
CalendarObject.currentView = 'week';
CalendarObject.refresh();

The problem is that for me the drop-down in the UI does not change to reflect which view its currently displaying.  It stays in the default one even though I am chaning it programtically.

How do I keep the drop-down in sync with the rest of the UI in the calendar.

Thanks
Photo of Sofware Developer Guy

Sofware Developer Guy

  • 1,354 Points 1k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Leo,

Not sure if this will work, but you could try to re-render the whole component, instead of just refreshing the calendar:

skuid.$C('CenterCalendar').render();
Photo of Sofware Developer Guy

Sofware Developer Guy

  • 1,354 Points 1k badge 2x thumb
Thanks Matt.  That works.