Our pure JavaScript Scheduler component


Post by omnitas2 »

Hi,

[I'm using 5.3.0-beta-1 scheduler pro, but this also occurs in 5.2.8.]

I have this time axis which is supplied as a prop to BryntumSchedulerPro:

export const timeAxis: Partial<TimeAxisConfig> = {
    filters: [
        (tick: any) => {
            return ![0, 6].includes(tick.startDate.getDay());
        }
    ]
};

...

export const staticSchedulerProConfig: Partial<BryntumSchedulerProProps> = {
...
    timeAxis
...
}
...
            <BryntumSchedulerPro ref={schedulerProRef} project={projectRef} {...staticSchedulerProConfig} />
...

This produces very weird results and makes random dates disappear. After several zoom in/zoom out operations (using SchedulerBase.zoomIn/zoomOut) I end up missing whole months or quarters and timeline shifts left (back in time) on every zoom operation (I ended up in 19th century after several zoom in/out)

I tried alternative approach to setting time axis filter using https://bryntum.com/products/schedulerpro-next/docs/api/Scheduler/data/TimeAxis#function-filterBy:

    const schedulerProRef = useRef<BryntumSchedulerPro>(null);
    const schedulerPro = () => schedulerProRef.current?.instance as SchedulerPro;

    const schedulerProValue = schedulerPro();

    useEffect(() => {
        if (schedulerProValue) {
            const f = async () => {
                await schedulerProValue.timeAxis.clearFilters();
                await schedulerProValue.timeAxis.filterBy((t: any) => ![0, 6].includes(t.startDate.getDay()));
            };

            f();
        }
    }, [schedulerProValue]);

to the same effect.

In fact, settings any filter (even noop () => true) produces similar results (timeline shifts left, however I haven't noticed any missing dates in that case), so it's not about that particular filter function.

Am I missing something? What's the correct way to use time axis filters with React?

Cheers,
Tomek

Attachments
Screenshot 2023-01-27 at 08.37.56.png
Screenshot 2023-01-27 at 08.37.56.png (9.81 KiB) Viewed 106 times

Post by tasnim »

Hello,

Thank you for your report. Reproduced! We'll check it deeply. Here is the ticket https://github.com/bryntum/support/issues/6070

Good Luck :),
Tasnim


Post by omnitas2 »

Thanks for quick response!
Looking forward for the fix as the client needs weekends filtered out. We're temporarily removing time axis filter.


Post Reply