JavaScript API Reference/Ab.timeline.TimelineController object

addOnChangeEvent(eventHandler)

Set the JavaScript event handler that will be called by the timeline control when the user modifies the event start and/or end time using drag-and-drop. Use it to implement custom event validation (i.e. if you want to check whether the event is valid according to additional rules or parameters).

Parameters:

  • eventHandler (function reference): The function should be defined in your code, and should accept one parameter:
    • event (object): Ab.timeline.Event object that is about to be changed.


Example:

timeline.addOnChangeEvent(onChangeEvent);
...
function onChangeEvent(event) {
// event should be at least 1 hour (6 10-min blocks)
return (event.getEnd() – event.getStart() + 1 >= 6);
}