[Timeline Add-on] Dynamically added markers only visible after page refresh

Heyho community,

I’m using a Timeline control in my application and want to show markers depending on the chosen date range of the graph.
But I don’t get an update of the Timeline control unless I refresh the whole page. I found
this article
which deals with the problem of updating ui components from foreign threads, but I’m not sure whether this is the root of my current problem.

Here’s my code that dynamically adds markers:

public void dateRangeChanged(DateRangeChangedEvent event) {
	Calendar calendar = Calendar.getInstance();
	long endDate = calendar.getTimeInMillis();
	long startDate = calendar.getTimeInMillis();
	if ((endDate - startDate) <= (1000 * 60 * 1)) {
		Collection<ForkliftState> states = this.stateService.find(this.vehicleName, event.getStartDate(), event.getEndDate(), false);
		Iterator<ForkliftState> iter = states.iterator(); 
		while (iter.hasNext()) {
			ForkliftState state = iter.next();
			Object markerItem = this.markerContainer.addItem();
			// Set the timestamp properties.
			this.markerContainer.getContainerProperty(markerItem, Timeline.PropertyId.TIMESTAMP).setValue(state.getTimestamp());
			// Set the value properties.
			this.markerContainer.getContainerProperty(markerItem, Timeline.PropertyId.CAPTION).setValue("E");
			this.markerContainer.getContainerProperty(markerItem, Timeline.PropertyId.VALUE).setValue("Test");

Any help is highly appreciated.


It appears that the Timeline does not attach listeners to the marker container when it is given to the Timeline (bug #1). That means it will not listen to changes in the marker container and update the changed value to the client side implementation.

There is also another bug (bug #2), which results in that you cannot remove already added markers since if the container is empty.

The relevant tickets are:
Bug #1:

Bug #2:

I’m sorry to say I don’t have any workarounds for these yet, it would most likely involve resetting the datasource somehow in the DateRangeListener.

Heyho John,

thanks for your response. I guess I can wait until these bugs are eliminated in one of the future releases.
It turned out that I can’t do what I wanted to by dynamically adding markers to the timeline.