calendar questions

Is it possible to set the start date for the calendar component on load dynamically to something else then the current date?

Can the calendar be updated to certain date from javascript so that it would be possible to create buttons like “3 weeks forward”, “next quarter” etc for quick acces to relevant dates?

Is it possible to get week numbers in the calendar component?

While we continue to work on Calendar API documentation, here are some pointers:

1. Every Calendar component has an underlying Calendar object which is what you want to interact with programmatically. To get at this object, you need a jQuery reference to the Calendar’s DOM element, then do a .data(‘object’), e.g. if you’ve given your Calendar a Unique Id “MyCalendar”, then you can do

var CalendarObject = skuid.$(‘#MyCalendar’).data(‘object’);

2. Setting the “date” of the Calendar can be done through the “useDate” property of the CalendarObject, e.g.

// Say we want our Calendar date to be September 5,2014
CalendarObject.useDate.setFullYear(2014,8,5);
CalendarObject.refresh();

3. As shown in the previous example, getting the Calendar to completely redraw itself is done through .refresh() — this redraws both the current Calendar View, as well as Events for all active Event Sources, after taking the given date range appropriate for the current View, and applying appropriate bounding Conditions to the Models for each Calendar Event Source. 

4. Buttons like “3 weeks forward” could absolutely be created which adjust the Calendar via JavaScript, using the above scenario. You would just need to adjust the Calendar’s current useDate relative to what it currently is.

5. For week numbers, are you saying you’d like to see the Week Numbers in the Calendar, or just get access to the Week Numbers via JavaScript? If the former, I’d post this as a separate Idea for an enhancement to the Calendar. If the latter, then yes you can get the ISO 8601 week number via a jQuery UI Datepicker utility method:

var weekNumber = skuid.$.datepicker.iso8601Week(CalendarObject.useDate);
// returns a number 1-53, see http://api.jqueryui.com/datepicker/ for more details

6. We recommend turning OFF the “Load Model Data on Page Load” property for your Event Source models, because the Calendar component will asynchronously “mess” with these Models when it runs, adding appropriate Bounding Conditions and requerying as necessary when you change views, change months/weeks/days, etc.

Zack,
Is there documentation on all of the objects, methods and properties that can be accessed in this way?  or do I have to use the console?

Just checking before I spend a lot of time going through them.

Thanks.

Unfortunately we have not published API documentation on the calendar yet. It is one of a few items on our backlog…