attachScheduler doesn't attach existing objects

In version 4.0.2 (the pro version at least, I’m assuming standard works the same in this regard), the layout cell’s attachScheduler() function appears to have a bug in it. If you specify the ID of an existing HTML element that the scheduler object should be placed within, the layout cell will correctly initialize the scheduler within the HTML element, but it fails to attach the HTML element to the layout cell.

For example, with this code snippet:

var calendarDivElement = document.createElement("DIV");
calendarDivElement.id = "calendarDiv";
layoutInstance.cells("a").attachScheduler(new Date(), "month", calendarDivElement.id);

A month-view calendar with the current date selected will be placed into a new DIV with the ID “calendarDiv”, but that DIV is not going to be a part of the layout defined by layoutInstance. This differs from the behavior in 3.6, where “calendarDiv” would have been correctly attached to the “a” cell of layoutInstance.

If anyone else has noticed a similar issue, I did find a workaround for this:

var calendarDivElement = document.createElement("DIV");
calendarDivElement.id = "calendarDiv";
layoutInstance.cells("a").attachScheduler(new Date(), "month", calendarDivElement.id);
layoutInstance.cells("a").attachObject(calendarDivElement); // or calendarDivElement.id, either works

This manually attaches the div to the cell after the layout finishes initializing the scheduler.

Hi

correct. please try attached updates. just include attach_scheduler.js after dhtmlx.js
attach_scheduler.zip (691 Bytes)

Thank you, this works.