Filtering duration field

Hello,

I use a duration field in my lightbox as follows:

{name: “time”, height: 72, type: “duration”, map_to: “auto”, time_format:["%d", “%m”, “%Y”, “%H:%i”]}

If it possible to filter the “time” drop-down to only the working time configured?

setWorkTime({ hours:[DAY_START_HOUR, (DAY_START_HOUR + DAY_DURATION )] });

Thanks in advance

You can define first_hour and last_hour parameters

docs.dhtmlx.com/scheduler/api__s … onfig.html
docs.dhtmlx.com/scheduler/api__s … onfig.html

and after that, add the next line

scheduler.config.limit_time_select = true;

It will limit time to the range from first_hour to the last_hour

Thank you. This was for the Gantt chart, your replies refers to the scheduler.

Will it work with the gantt object as well?

Actually it will work for the gantt as well

This is not a documented feature ( as first_hour and last_hour have not sense in the gantt ) but due to code sharing between scheduler and gantt the above properties work for both components.

Thanks for the reply but it does not work, it actually breaks the control completely.

After I had the code below when I double-click on a task to display the lightbox the whole page simply freezes without any error message…

I am using the pro version.

this.m_gantt = Gantt.getGanttInstance( );

this.m_gantt.init( this.m_ganttDiv );

this.m_gantt.config.first_hour = 9;
this.m_gantt.config.last_hour = 18;
this.m_gantt.config.limit_time_select = true;

The code seems work in the default sample, so the error must be caused either by some conflicting settings (which hard to tell without the demo) or by something in your code

The sample is attached (html page only, samples/20_multiple/01_basic.html )
multiplegantt_limit_time_select.zip (1017 Bytes)

You can see the failing demo at:

dev.jetty.tgmt-systems.com/ganttProto/index.jsp

I’ve confirmed the problem. I’ll check if we can provide a quick fix

Thanks again for the great support :smiley:

Hello There.

Is there any updates on this?

Hi,
try this patch
dhtmlxgantt_3.1.0_limit_time_select_patch.zip (1.51 KB)

Works like a charm - Thank you.