Our state of the art Gantt chart

Post by johanbrodin »


I want to ask a question on a problem we have. We can solve the problem with rather ugly workarounds however you might have a better way!

Our app has multiple listeners for different tasks manipulations. One example is if you change a task name we will store the value in a remote system.

However when the (onDataChange) event is called we cannot resolve if the change is because of a user manually changing a value e.g. name or if it is a new task inserted with code. Also a bug we see is inserting multiple tasks with "this.gantt.addTaskBelow" (onDataChange) is called only for the first task.

So all to all have you considered to add e.g. an event.type in (onDataChange) with e.g. manual or api as value to differentiate. Or have you another recommend way filter out user input events.

//Catching event
onGanttChange(event: any) {
        try {
            if (event.action == "update") {
                    if (event.changes.name != undefined && (event.changes.name.oldValue != event.changes.name.value)) {
                        //we only want to be here if the use enters the change manually
        } catch (err) { }
//triggers onGanttChange to be called - also as described below onGanttChange is only called for the first issue which seems like a bug... for (var i = 0; i < issues; i++) { var issue = issues[i]; var tmp: any = await this.gantt.addTaskBelow(tmp); tmp.name = issue.name; tmp.percentDone = issue.progress }


Post by alex.l »

I see as many datachange events as it should. Tested on advanced example.

Screenshot 2023-02-07 at 09.26.27.png
Screenshot 2023-02-07 at 09.26.27.png (99.83 KiB) Viewed 37 times

Regarding to how to detect if it's manual changes or not. On data level there is no straight flags for that. You choose a correct way to review changes and make your conclusions. You could try to use UI level events, but you'll need to catch them in many places, like

etc, depends on your goals.

All the best,

Post by johanbrodin »

ok then we go with a workaround. Please close this issue

Post Reply