StephenChou1017 / react-big-scheduler

A scheduler and resource planning component built for React and made for modern browsers (IE10+)
https://stephenchou1017.github.io/scheduler/#/
MIT License
759 stars 414 forks source link

How to Change the Component width and make it responsive #206

Open NBenzekri opened 4 years ago

NBenzekri commented 4 years ago

Hi,

I found this component very helpful in my project, so thanks for that.

I have a problem when I want to make the component width responsive to the page width, as you see in the image when I zoom out the width became smaller and the user find a problem to see all the data even if he open it in a big screen.

So How I can handle the scheduler width? and also the resource Column width, it stills bigger than the content size.

image

nielsuit227 commented 3 years ago

Did you figure out a fix in the end? Very curious.

NBenzekri commented 3 years ago

unfortunately, nop 👎 :(

mixa9269 commented 2 years ago

If someone else is looking for this possibility, then it can be helpful

Root of app

import ResizeObserver from 'react-resize-detector';

<ResizeObserver><App /></ResizeObserver>

Scheduler

import { useResizeDetector } from 'react-resize-detector';

const { width, ref } = useResizeDetector();

    if (width) {
      // it's ok to mutate state here
      viewModel.config.schedulerWidth = width;
    }

    return (
      <div ref={ref}>
        <Scheduler
          schedulerData={viewModel}
          ...
        />
      </div>
    );