Widget Intermittently not Displaying

  1. Avatar of Doug Lim

    I am using Bootstrap-Calendar (https://github.com/Serhioromano/bootstrap-calendar) in a Razor view to develop an event calendar widget. In the widget configuration, I have defined two JS Include URL Widget Options: 1) for the Bootstrap-Calendar module; 2) glue javascript to call a web service to retrieve event data and initialize the calendar.

    I am having an issue where the calendar intermittently does not render/display when the containing page is viewed. The page HTML consistently renders with the two expected <script> tags corresponding to each JS Include URL Widget Option. The glue JS code consistently calls the web service and returns event data in JSON on each page view. After the event data is retrieved by the glue code, it is then supposed to call the Bootstrap-Calendar initialization method to load the data into the calendar and render a month view. If I set a breakpoint in the Bootstrap-Calendar initialization method, on page refreshes where the calendar is not displayed, the breakpoint in the Bootstrap-Calendar initialization method never gets hit. On the page refreshes when the calendar does not display, there are no messages in the javascript console.

    When the application is built and run, the first view of the page containing the Bootstrap-Calendar widget does not display. On the second and subsequent refreshes of that page where the widget does display properly. If the application is left idle for a few minutes, the first refresh of that page with the widget more often than not tends to not have the calendar display.

    It appears that when the widget does not display, not all of the code in the JS files specified in the JS Include URL Widget Options completely runs.

    Has anyone seen any similar issues where widgets don't render due to javascript code specified in JS Include URL Widget Options unexpectedly stops executing?

  2. Avatar of Doug Lim

    After some additional investigation, I have determined that this issue appears to be specific to the Bootstrap-Calendar module rather than an issue with Better CMS. The calendar initialization was not getting called (as opposed to my suggestion that it was getting called but failing quietly with no errors) because of an error on my part in code that was supposed to check for the existence of the target container DIV was really checking for the existence of the calendar module's initialization method - the calendar class is not consistently being created even though I can see (with appropriately placed console.log statements) the module's JS file being loaded and executed.

* Mandatory
* Mandatory
* Mandatory

Verify that you are human