react-gantt icon indicating copy to clipboard operation
react-gantt copied to clipboard

Showing the table on resize only

Open KhushilMistry opened this issue 6 years ago • 6 comments

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

Can you guide me here little?

KhushilMistry avatar Nov 20 '18 22:11 KhushilMistry

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

clayrisser avatar Nov 20 '18 22:11 clayrisser

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 avatar Nov 21 '18 09:11 KhushilMistry

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

KhushilMistry avatar Nov 22 '18 06:11 KhushilMistry

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

clayrisser avatar Feb 21 '19 07:02 clayrisser

+1

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

thomaskleiven avatar Aug 16 '19 08:08 thomaskleiven

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

clayrisser avatar Aug 16 '19 08:08 clayrisser