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

Showing the table on resize only #17

Open
KhushilMistry opened this issue Nov 20, 2018 · 6 comments
Open

Showing the table on resize only #17

KhushilMistry opened this issue Nov 20, 2018 · 6 comments

Comments

@KhushilMistry
Copy link

KhushilMistry commented Nov 20, 2018

Uncaught TypeError: Cannot read property 'offsetWidth' of undefined
at ReactGantt.handleResize (index.js:108)
at index.js:93

Can you guide me here little?

@clayrisser
Copy link
Owner

Would you mind reproducing the error in a sample repo and sending me the link?

@KhushilMistry
Copy link
Author

KhushilMistry commented Nov 21, 2018

Before Resizing

screenshot 2018-11-21 at 2 40 01 pm

After Resizing

screenshot 2018-11-21 at 2 40 12 pm

Repo : https://github.com/KhushilMistry/Managi

Clone the repo.
Commands to star: yarn && yarn start
Go to: http://localhost:3000/signin
Credentials:
Email: [email protected]
Password: kbm123
Select any team from the following list. Go to Gantt Chart Tab.

@KhushilMistry
Copy link
Author

KhushilMistry commented Nov 22, 2018

https://github.com/codejamninja/react-gantt/blob/e42da2d7ed75353aa18d3c95e17838c3484c0fc5/src/index.js#L98-L101

Here, this.refs.timeline.offsetWidth is getting undefined after the mounting of the initial screen. So it's showing an error. Giving it some initial condition will solve the error.
Something like this.

handleResize() { 
   this.setState({ timelineWidth: 0 }); 
   this.setState({ timelineWidth: this.refs.timeline.offsetWidth || 1020 }); 
 } 

What do you think ? @codejamninja

@clayrisser
Copy link
Owner

I should get a chance to look at this issue sometime this week.

@thomaskleiven
Copy link

+1

@codejamninja did you get a chance to look at this? Would be cool because it is really a useful library :)

@clayrisser
Copy link
Owner

@thomaskleiven thank you for reminding me. I will get to it soon.

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

3 participants