Skip to main content

Is there any kind of event fired when a calendar view is first loaded? I’d like to hook it.

hmm, the only events that I could find are ‘calendar.refreshed’ and ‘calendar.eventsDrawn’, neither of which suits my purpose, unless I’m misunderstanding calendar.refreshed.

I have a settings object which includes a multipicklist field of the days of the week, which is designed to allow the user to select which days to show on all calendars by default.

Then I have this running on pageload on each page where I have a calendar component:


//Remove Non-default days from Week and Month Calendars<br>if( $('.nx-cal').length &amp;&amp; $('.nx-cal-dowpicker').length) {<br>var defaults = skuid.$M('DefaultCenter') &amp;&amp; skuid.$M('DefaultCenter').getFirstRow();<br>if (defaults) {<br>var daysString = defaults.Scheduling_Days__c,<br>daysArray = daysString.split(";"),<br>daysToClick = {};<br>//look into using $.map() for this?<br>$.each($t.dayNames,function(i,d){<br>if (daysArray.indexOf(d) === -1) {<br>$('.nx-cal-dowpicker').children()ci].click();<br>}<br>});<br>}<br>}


There are probably better ways to accomplish this than just clicking on the day with jQuery, but it works.

The problem is, this will only work for whichever calendar view is shown on pageload. If we switch views, the new view shows all days.

Any way I can cause skuid to run this code when a view is first loaded? 


Reply