Discuss anything related to web development but no technical support questions


Post by mavi »

Is it possible to hide the non-working time from a calendar (i.e. weekends, holidays and non-workable hours during the day) in the Gantt view?

We would like to have an option to switch between displaying the full calendar in the Gantt or displaying only the working days in the calendar.

How can we achieve this?
Last edited by mavi on Tue Feb 09, 2016 1:18 pm, edited 1 time in total.

Post by mats »

You can try filtering the time axis, which gives you full control over what's shown. See this sample:

https://bryntum.com/examples/scheduler-l ... eaxis.html

Post by mavi »

This works fine for showing / hiding non-workable days.

If I understand it correctly, in order to show workable / non-workable hours on day level an own implementation of the time-axis object must be created like in the sample.

We need the possibility to toggle between displaying and hiding the non-workable time. Can we switch the time-axis used during runtime or can there be only one time-axis that is set when creating the control?

Post by Maxim Gorkovsky »

Check 'FilterableTimeaxisScheduler' in that example, no reconfiguration required.

Post by mavi »

I checked that example and it gives me a good option to hide the non workable days, i.e. Saturday and Sunday.

But suppose the following:
- Saturday and Sunday are non-working days
- Monday to Friday have working hours from 8:00 - 12:00 and from 12:30 to 16:30.

When hiding non-workable time in the Gantt I want to see:
- only Monday, Tuesday, Wednesday, Thursday and Friday
- On the working days (mo - fr), only the working hours, so 8:00 - 12:00 and 12:30 - 16:30 or if that is not possible 8:00 - 16:30.
This logic should obviously depend on the current zoomlevel.

Especially when working on very detailed levels, hiding the non-workable hours makes sense, because otherwise most of the space displayed is non-workable time and it requires a lot of scrolling due to this.

I don't see how to achieve that by only using the filter on the time-axis, so probably I´m missing something here.

Post by Maxim Gorkovsky »

I don't see any problems here. If you inpect code of the above example you may see following method:
scheduler.getTimeAxis().filterBy(function (tick) {
  // if tick represent working time return true, otherwise return false
  // tick object has start and end dates
});
Unlikely logic should depend on zoom level, your filtering method should be simple and only filter out non-working time.
Also please read doc on filterBy method.

Post Reply