Our pure JavaScript Scheduler component


Post by burnit »

Hi,

we would like to initially filter the time-axis for non-working time.
We have a button implemented as you did in your demos. This works fine.

instance.timeAxis.filter((t) =>
          scheduler.project.calendar.isWorkingTime(t.startDate, t.endDate)
        );

How can we do this initially?

Many thanks


Post by alex.l »

Hi burnit,

That's described here https://bryntum.com/products/gantt/docs/api/Scheduler/data/TimeAxis

A class representing the time axis of the scheduler. The scheduler timescale is based on the ticks generated by this class. This is a pure "data" (model) representation of the time axis and has no UI elements.

The time axis can be continuous or not. In continuous mode, each timespan starts where the previous ended, and in non-continuous mode there can be gaps between the ticks. A non-continuous time axis can be used when want to filter out certain periods of time (like weekends) from the time axis.

To create a non-continuous time axis you have 2 options. First, you can create a time axis containing only the time spans of interest. To do that, subclass this class and override the generateTicks method.

The other alternative is to call the filterBy method, passing a function to it which should return false if the time tick should be filtered out. Calling clearFilters will return you to a full time axis.

So, in other words, you could make non-continuous timeAxis using own implementation of https://bryntum.com/products/gantt/docs/api/Scheduler/data/TimeAxis#property-generateTicks method.
Here is an example https://bryntum.com/products/schedulerpro/examples-scheduler/timeaxis/

All the best,
Alex


Post by burnit »

Hi Alex,

yes but i have already the filter funtction.

  timeAxis: {
    filters: [(t) => scheduler.project.calendar.isWorkingTime(t.startDate, t.endDate)],
  },

But i have an AppConfig which is loaded into SchedulerPro.
So it tells me scheduler is undefined


Post by tasnim »

Hello Burnit,

  timeAxis: {
    filters: [(t) => scheduler.project.calendar.isWorkingTime(t.startDate, t.endDate)],
  },

Could you please show the whole code? and from where the scheduler is coming?


Post Reply