Hi all, I’m currently trying to block off times on the scheduler but I need to two so in two completely separate functions.
Thus far if I perform an addMarkedTimespan for one date and then do it again for the same date, the second addMarkedTimespan never shows up, only the first. How can I solve this?
The code in question:
In function A
data.forEach(function(obj) {
scheduler.addMarkedTimespan({
days: new Date(obj.date),
zones: [obj.start * 60, obj.end * 60],
invert_zones: false,
html: “” + obj.desc + “”,
type: “dhx_time_block”,
css: obj.color + “_section”
});
});
in function B
data.forEach(function(obj) {
var weekday = obj.weekday;
if (weekday == 7) weekday = 0;
var start = obj.start.split(":");
var end = obj.end.split(":");
var totalStart = parseInt(start[0]) * 60 + parseInt(start[1]);
var totalEnd = parseInt(end[0]) * 60 + parseInt(end[1]);
scheduler.addMarkedTimespan({
days: weekday,
zones: [0, totalStart, totalEnd, 24*60],
invert_zones: false,
type: "dhx_time_block",
css: "grey_section"
});