Duration_step and time_step


#1

Hi,

My current configuration is:

gantt.config.duration_step = 30;        
gantt.config.duration_unit = 'minute';
// Not exactly sure what this affects
// gantt.config.time_step = 60;

I kind of get what this is, each duration is 30 minute, so if my task if 2 unit, then it will be 1 hour for my task.

However, when I try to drag the task on my timeline, I am able to see that the duration unit change from 8 (3AM) to 9 and 10 and so on during the drag, but it will not be locked to 9 (3.30AM). Instead it can only be locked to 10 or 12 or so on.

image

image

And then I tried to use time_step to see if it is what makes it work. But it isn’t, and from my observation, I couldn’t see what exactly is the usage for time_step.

I thought it might be for the lightbox when editing the task.
image

But it isn’t. I read the documentation but couldn’t really catch it is really mean.

What I’m trying to achieve is that on drag, it should be able to allow me to drag in the duration block and lock it. Meaning that based on the configuration I stated above, I should be able to lock on Duration (unit) 9 instead of only 10, 12 and so on. Am I looking at the wrong place?

And also like to know what exactly does time_step does. An snippet/explanation would really help.

As usual, you can find a copy of my demo at GitHub.

Thanks.


#2

Hi @Jozeph!

By default tasks snap to time scale cells on drag and drop, so time_step won’t affect d’n’d dates directly.
Try disabling it with round_dnd_dates config:
gantt.config.round_dnd_dates = false.

After that, drag and drop dates won’t depend on the time scale anymore and will be calculated according to time step config.
For example, allocate tasks with 30 minutes step:
gantt.config.time_step = 30;
https://docs.dhtmlx.com/gantt/api__gantt_round_dnd_dates_config.html

Alternatively, you can leave round_dnd_dates enabled and change the step of the time scale to match the time step you want to drag and drop tasks.

https://docs.dhtmlx.com/gantt/api__gantt_step_config.html
https://docs.dhtmlx.com/gantt/api__gantt_subscales_config.html

Here is a sample, where you can see how do these properties work: