Activity repositories are used by rows to store and lookup activities. Each Row by default owns an IntervalTreeActivityRepository. This default repository can be replaced with a custom one, for example if your application requires a lazy loading strategy. You can access the ActivityRepository of a given Row by calling the following method: row.getRepository()


The most important functionality of any repository is the ability to query the repository for activities within a given time interval. For this purpose the ActivityRepository interface defines the following method:

repository.getActivities(layer: Layer, startTime: number, endTime: number, temporalUnit: TemporalUnit, zoneId: ZoneId)

Whenever the user scrolls left or right the row will query the repository several times. Once for each layer.


The start time of the time interval for which the row is querying activities.


The end time of the time interval for which the row is querying activities.


The current value of the primary temporal unit currently displayed by the dateline. This is the unit shown at the bottom of the dateline, e.g. days. This parameter can be used to control how fine-grained the result will be. If we know that the user is currently looking at months then it might make sense to aggregate daily activities.

The timezone shown by the row.

Earliest / Latest Time Used

Each repository implementation needs to be able to answer the question for the earliest and latest times used (earliest start time / latest end time of any activity stored in the repository). This allows the UI to provide controls for easy navigation: "show earliest", "show latest". For this purpose repositories need to implement repository.getEarliestTimeUsed() and repository.getLatestTimeUsed() methods.

Updating Activities

Activities need to be removed with activityRef.detachFromRow() from their repository before they are being changed and added back activityRef.attachToRow() after they have been changed. This is the only way to ensure that a repository will always have its underlying data structure in sync with the activities. Example: the interval tree data structure only works properly if all its nodes are in their correct location. This can only be guaranteed if the nodes are removed from the tree before they are being changed (otherwise the tree will not find them) and then reinserted with their new value.