Skip to content

[Bug]: GanttChart function setDate() can't be used with array (i.e. list of) objects #2111

@filug

Description

@filug

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Using following code snippet (example taken from the documentation → https://docs.lowcoder.cloud/lowcoder-documentation/build-applications/app-editor/visual-components/project-management/gantt-chart)

ganttChart1.setData([
    {
        "label": "Some Project",
        "start": "2025-04-29T12:45:00.000Z",
        "end": "2025-05-14T19:00:00.000Z",
        "id": "ProjectSample",
        "project": "",
        "progress": 25,
        "type": "project",
        "hideChildren": false,
        "displayOrder": 1,
        "dependencies": [
            ""
        ]
    },
    {
        "label": "Idea",
        "start": "2025-04-29T12:45:00.000Z",
        "end": "2025-04-30T17:23:00.000Z",
        "id": "Task 0",
        "project": "ProjectSample",
        "progress": 45,
        "type": "task",
        "hideChildren": false,
        "displayOrder": 2,
        "dependencies": [
            ""
        ]
    }
]);

is incorrectly handled by the lowcoder. This list of objects is added to one more list, so we are ending with data

ganttChart1.data = [[object1, object2, ...]];    // note double [[...]] here 

instead of

ganttChart1.data = [object1, object2, ...];

Currently setData can be used to add only one task to the chart (by using object as an argument, see example below); but it's not possible to add more than one task to the list.

Working (with one task) code snippet.

ganttChart1.setData(
    {
        "label": "Some Project",
        "start": "2025-04-29T12:45:00.000Z",
        "end": "2025-05-14T19:00:00.000Z",
        "id": "ProjectSample",
        "project": "",
        "progress": 25,
        "type": "project",
        "hideChildren": false,
        "displayOrder": 1,
        "dependencies": [
            ""
        ]
    }
);

Expected Behavior

It should be possible to use setData function to add many tasks to the chart.
Basically, it should be possible to use - defined by the documentation (https://docs.lowcoder.cloud/lowcoder-documentation/build-applications/app-editor/visual-components/project-management/gantt-chart#methods) - example from the JS function.

Steps to reproduce

  1. add GanttChart,
  2. create JS function with code like define in the documentation → https://docs.lowcoder.cloud/lowcoder-documentation/build-applications/app-editor/visual-components/project-management/gantt-chart#methods
  3. run manually JS function

Note: Issue can be reproduced also when function is triggered automatically, by the temprary state change, or query execution, etc.

Environment

  • Lowcoder 2.7.6 (via docker lowcoderorg/lowcoder-ce:2.7.6)
  • Reproduced also on 2.7.4 (also in docker) based setup.

Additional Information

From UI point of view, GanttChart → data field after JS function exection looks like presented below

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions