Our pure JavaScript Scheduler component


Post by mrengineerx »

Hi. I need to implement zoomToFit feature on timeline based on min/max date event values. How do I do that? How do I pass this zoomToFIt "react way" into the config?


Post by saki »

zoomToFit is a function you need to call on the Scheduler instance. For example:

const App = props => {
    // Scheduler ref forwarded to Scheduler component
    const schedulerRef = useRef(null);

    useEffect(() => {
        schedulerRef.current.instance.zoomToFit(options);
    }, [somethingThatChanged]);
    
   // etc.
    return (
        <Scheduler
            {...schedulerConfig}
            ref={schedulerRef}
    // etc.
};

Note: The above is a pseudo-code meant for explanation only; it won't work if copy&pasted.


Post Reply