Scheduler 3.6+ Inside DIV With Display None

Putting a scheduler object inside another div and setting that div to display none cause an invalid argument exception. The usage case is having a drop down list with different schedules. By changing the drop down I want to load a different timeline. The list allows a default selection of none. When this is selected I was to hide the scheduler. The code is to wrap a div around the scheduler and just toggle the display.


Hello,
scheduler can’t be rendered inside a container with display:none.
It calculates sizes of inner elements based on container’s widht and height, which are both 0 when container is not displayed.
At some stage element will get negative size and that will trigger ‘Invalid argument’ error in IE8 and older.

The easiest way to prevent this is to override scheduler.updateView method in order to render scheduler only when it’s visible:var oldRender = scheduler.updateView; scheduler.updateView = function(){ if(checkDisplayValue()){//check if scheduler is displayed oldRender.apply(scheduler, arguments);//if displayed - render it as usual, }//otherwise - do nothing };

The code you provided does not work. There is no function checkDisplayValue(). Besides, I would think that the built-in functionality would check the outside container for the display value before attempting to render the width and height to negative values.

Here is the working code,
you need to overwrite two methods: .updateView and .update_view function isVisible(){ return Math.min(scheduler._obj.offsetWidth, scheduler._obj.offsetHeight) > 0; } var oldUpdateView = scheduler.updateView; scheduler.updateView = function(){ if(isVisible()){ oldUpdateView.apply(scheduler, arguments); } }; var oldUpdate_view = scheduler.update_view; scheduler.update_view = function(){ if(isVisible()){ oldUpdate_view.apply(scheduler, arguments); } };In case scheduler has been initialized inside the display:none container, you will need to specify view and date when you render it for the first time:
scheduler.updateView(new Date(), “week”);
simple scheduler.updateView() might not work

Thanks. I would try to work this into 3.7 as a default way to handle the issue so the user is not responsible for manually coding this case.