Skip to main content

I am displaying multiple users on a single calendar and given the volume the query could take some time to display. On initial load I can control the first query and display a wait message to the user so they don’t think the screen is locked up or not working. 

Is there a way to hook into an event that is triggered when the calendar does a re-query so that I can display a wait message?

I think putting a model action on the model that the calendar is based on should do the trick.  Just create a new model action and use the “Model Requeried” Initiating Event.


Oh wait, that might happen after the query is done.  I’ll have to think about this a bit more.


Ok, this isn’t officially supported, and we should probably create a more formal event for handling this, but the following code should work as an “In-Line” javascript resource.


var defaultCalendarEvent = skuid.calendar.Calendar.prototype.loadEvents;<br>skuid.calendar.Calendar.prototype.loadEvents = function() {<br>&nbsp; &nbsp; console.log('Before Load!!!!');<br>&nbsp; &nbsp; defaultCalendarEvent.apply(this);<br>&nbsp; &nbsp;&nbsp;<br>};




Thanks Ben. That does work for executing before calendar loads but my next hurdle is that the event returns immediately which means I can’t display a loading message for the duration that the query is executing. Unless there is some callback option in the method I can take advantage of. 



Yeah, then you’d need to do this…


var defaultLoadEvent = skuid.calendar.Calendar.prototype.loadEvents;skuid.calendar.Calendar.prototype.loadEvents = function() {<br>&nbsp; &nbsp; console.log('Before Load!!!!');<br>&nbsp; &nbsp; defaultLoadEvent.apply(this);<br>};<br>var defaultDrawEvent = skuid.calendar.Calendar.prototype.drawEvents;<br>skuid.calendar.Calendar.prototype.drawEvents = function() {<br>&nbsp; &nbsp; console.log('Before Draw!!!!');<br>&nbsp; &nbsp; defaultDrawEvent.apply(this);<br>&nbsp; &nbsp; console.log('After Draw!!!!');<br>};

Thanks! That works like a charm.