JavaScript
Builds 1748 and later support partial .update(). You can use it to add a sliding separator:
var slidingTimeout = null;
function showCurrentTime() {
slidingTimeout = setInterval(function() {
dp.update({
separators: [{color:"Red", location: new DayPilot.Date()}]
});
}, 60000); // once per minute
}
function hideCurrentTime() {
dp.update({
separators: []
});
clearInterval(slidingTimeout);
}
If there are other (static) separators in use you can mark the current-time indicator with a special property (the example below uses "currentTime" property) and copy the static separators during update:
var slidingTimeout = null;
function showCurrentTime() {
slidingTimeout = setInterval(function() {
var separators = dp.separators.filter(function(sep) { return !sep.currentTime; });
separators.push({ location: new DayPilot.Date(), color: "red", currentTime: true});
dp.update({separators: separators});
}, 60000); // once per minute
}
function hideCurrentTime() {
dp.update({
separators: dp.separators.filter(function(sep) { return !sep.currentTime; })
});
clearInterval(slidingTimeout);
}
DayPilot