angular-visjs icon indicating copy to clipboard operation
angular-visjs copied to clipboard

Event handling in case of multiple timelines

Open adnia opened this issue 8 years ago • 0 comments

Hi,

I have a scenario where I read and create multiple timelines, one respectively for different persons.

I register an "select" event handler to each timeline; this event handler shall unveil a description associated with each item (to provide more details on demand).

However, although I register the event handler function with each timeline I create, it only works for the last timeline created. In the other timelines, I can select items as well, but the event handler is not executed at all.

This is the code I use to register the event handler:

    var timelines;

    function loadTimeline(member, items, groups, options) {
        // Define and create child div of "timelines" to load timeline in
        // [...]
        var container = document.getElementById(member["id"]);

        var timeline = new vis.Timeline(container, items, options);
        timeline.setGroups(groups);

        timeline.on("select", selectEvent);
        timelines.push(timeline);
    }

adnia avatar Nov 25 '16 14:11 adnia