Change status based on its progress

Hello,
If I change my task’s progress to 100%, how can I automatically change the tasks status? If i have a task with “in progress” status and change progress to 100% I need to show “Completed”.
How can I do that?

Hello Arthur,
You can do that by using onAfterTaskUpdate event handler:
https://docs.dhtmlx.com/gantt/api__gantt_onaftertaskupdate_event.html
You can check if task’s status is “In progress” and its progress is 1.
Here is an example of how it might work:
http://snippet.dhtmlx.com/cc526e87e

If I change my progress to <1 or progress > 0 I get the task status “In Progress”:

image

But if I try to change not the progress but the Task Status to “Deferred”:

My status wont change because of my progress:

image

How can I change my status with my progress and status?

Snippet: DHTMLX Snippets

Thank you.

Hello Arthur,
In that case, you can change the event handler. You can check if you change the progress in the onAfterTaskDrag event handler and change the status:
http://snippet.dhtmlx.com/dc0a9689c