Change status based on its progress

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:
You can check if task’s status is “In progress” and its progress is 1.
Here is an example of how it might work:

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


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

My status wont change because of my progress:


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: