Filter on Gantt Chart

Hi everyone,

I have a gantt chart which uses a datasource categoryDs, whose Category entity is related by COMPOSITION of one to many with its Segments.
I want to use a filter to show segments that have a specific feature, for example, those of blue color, but I tried using the filter to a nested data source (Segments) but it didn’t work.
I also tried adding another Datasource collection of segments and matching the datasource by the prefix ds by adding the following to categoryDs: where e.segments in: ds $ segmentsDs and it didn’t work either.
Anyone have any idea how to assign a filter to a parent datasource by a field of their child datasource?

Beforehand thank you very much.


Unfortunately, we cannot filter nested datasource using query and another collection will not affect to filter since GanttChart takes a collection from the entity’s property. So we have to filter data in memory.

I can suggest using a not-persistent entity to show filtered data. It should contain the category and list of segments.
When data is loaded we will create not-persistent entities and fill them with filtered segments:

public void initData() {
    for (TaskSpan taskSpan : taskSpansDs.getItems()) {
        FilteredTaskSpan filteredTaskSpan = metadata.create(FilteredTaskSpan.class);
protected List<Segment> getFilteredSegments(TaskSpan taskSpan) {
    return taskSpan.getSegments().stream().filter(segment -> {
        String task = taskField.getValue();
        if (!Strings.isNullOrEmpty(task)) {
            return task.equals(segment.getTask());
        return true;


Demo project on 7.1.1 version. It contains two exmaples for Datasource and for DataContainer: (108.4 KB)