Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specific usage of responsiveByParent #26

Open
DAIMENGEN opened this issue Sep 8, 2023 · 1 comment
Open

Specific usage of responsiveByParent #26

DAIMENGEN opened this issue Sep 8, 2023 · 1 comment
Labels
question Further information is requested

Comments

@DAIMENGEN
Copy link

DAIMENGEN commented Sep 8, 2023

const App = () => {
    const contentRef = useRef()
//.................
const config = {
        schedulerWidth: '90%',
        responsiveByParent: true,
        views: [
            { viewName: 'Year', viewType: ViewType.Year, showAgenda: false, isEventPerspective: false }
        ]
    }

return (
<Content ref={contentRef} style={{margin: '24px 16px', padding: 24, minHeight: 280, background: colorBgContainer }}>
       <SimpleScheduler parentRef={contentRef} config={config} resources={resources} events={events} viewType={ViewType.Year}/>
     </Content>
)
};


const SimpleScheduler = (props) => {
// .......
return (
        <Scheduler
            parentRef={props.parentRef}
            schedulerData={schedulerData}
            prevClick={prevClick}
            nextClick={nextClick}
            onSelectDate={onSelectDate}
            onViewChange={onViewChange}/>
    )

}

Result: Scheduler does not adapt to the width of the parent component。
image

@DAIMENGEN DAIMENGEN added the question Further information is requested label Sep 8, 2023
@AsifDaum
Copy link

AsifDaum commented Sep 9, 2023

Ive got the same issue, it wont conform to the outside parent div.

image

I have applied useRef for parentRef, but that was not fruitful either.

 let schedulerData = new SchedulerData(
    date,
    ViewType.Day, // Change the status of daily, weekly or monthly
    false,
    false,
    // Switch Resources and task name area
    {
      responsiveByParent: true,
      startResizable: false,
      endResizable: false,
      schedulerContentHeight: "100%",
      weekResourceTableWidth: 160,
      weekCellWidth: 80,
      // minuteStep: 15
    }
  );

  const schedulerParentRef = useRef();
  
  const [viewModel, setViewModel] = useState(schedulerData);
  
      <div className="w-full" ref={schedulerParentRef}>
      <div className="-mt-4" style={{ marginLeft: "auto" }}>
        <Scheduler
          parentRef={schedulerParentRef}
          schedulerData={viewModel}
          prevClick={prevClick}
          nextClick={nextClick}
          onSelectDate={onSelectDate}
          onViewChange={onViewChange}
          eventItemClick={eventClicked}
          viewEventClick={ops1}
          viewEventText="Details"
        />
      </div>
      </div>

It was referenced here on how to use it, but its not exactly for function based components.

StephenChou1017#260

Plus it seems that its more often used in class based components than function-based ones, that should still not be the cause right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants