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

[Question] Error in functional component implementation #18

Open
jaballogian opened this issue Feb 24, 2022 · 1 comment
Open

[Question] Error in functional component implementation #18

jaballogian opened this issue Feb 24, 2022 · 1 comment

Comments

@jaballogian
Copy link

Hello,

I'm trying to recreate this https://github.com/DHTMLX/react-scheduler-demo demo using the functional component instead of the class-based component here https://codesandbox.io/s/learn-dhx-scheduler-04r17f.

But there is an error with the scheduler below.

TypeError
this.$container.setAttribute is not a function

image

What's the source of the error and what's the solution to use the DHTMLX Scheduler component with functional component properly?

@aryanisml
Copy link

scheduleRef is null; you cant set the value in null div.
try this one

//const schedulerRef = useRef();
const schedulerRef = useCallback((node) => {
if (node !== null) {
console.log(node);
scheduler.init(node, new Date(2020, 5, 10));
scheduler.clearAll();
scheduler.parse(events);

  scheduler.render();

  setHoursScaleFormat(timeFormatState);
  //setHeight(node.getBoundingClientRect().height);
}

}, []);

Try this one
https://codesandbox.io/s/learn-dhx-scheduler-demo-forked-eehe3r?file=/src/components/Scheduler/Scheduler.jsx

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

No branches or pull requests

2 participants