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

MultiGrid with fixedRowCount is rendering incorrect width #675

Merged
merged 1 commit into from
May 20, 2017

Conversation

marcelmokos
Copy link
Contributor

@marcelmokos marcelmokos commented May 6, 2017

Issue: #660

I am first time contributor to react-virtualized. Please excuse me for not providing a code example. I can create one if it will be necessary for accepting PR.

CellMeasurer during rerendering of the table is setting width: "auto" to the table cells in measure methods. This width "auto" is causing incorrect cell rendering mostly visible on cell backgrounds.

widthauto

This fix of CellMeasurer is remembering width and height of the cell before measuring.
Measuring is setting styles for width and height to "auto" prior measuring.
The fix is setting remembered width and height back after measuring.

@marcelmokos marcelmokos changed the title #660 MultiGrid with fixedRowCount is rendering incorrect width MultiGrid with fixedRowCount is rendering incorrect width May 7, 2017
@bvaughn
Copy link
Owner

bvaughn commented May 8, 2017

Hey @marcelmokos! Welcome 😄

I'm not sure I understand the need for this fix. CellMeasurer only sets width to "auto" if its cache is configured not to have a fixed-width- and it only does so initially (when the cell hasn't yet been measured). Once the cell(s) have been measured, the list/table/grid is always re-rendered (because of how positions are calculated and cached) at which point the "auto" value won't be set again because size is already known.

I'd need to know more (probably a Plnkr that repros the unexpected issue you're seeing, that I could actually take a look at) before I want to change this code because it seems like the current implementation is reasonable.

@marcelmokos
Copy link
Contributor Author

Thanks, I will create a public example.

@marcelmokos
Copy link
Contributor Author

Thanks for your awesome library.
I was able to create examples.

This example uses not modified CellMeasurer, CellMeasurerCache
I am using the width of the component to determine if the cache should be invalidated. When the cache invalidates items are rendered incorrectly.
Edit react-virtualized
react-virtualized

This example uses modified CellMeasurer, CellMeasurerCache that allows resizing of the table when width of the table changes
This PR is not about CellMeasurerCache change am just showing why I am proposing the change of CellMeasurer. With proposed change in CellMeasurer, I am no longer experiencing the issue after deleting cache.
Edit react-virtualized

resizible-react-virtualized

@bvaughn
Copy link
Owner

bvaughn commented May 20, 2017

Thanks for the demos. 😄

@bvaughn bvaughn merged commit eafd946 into bvaughn:master May 20, 2017
@bvaughn
Copy link
Owner

bvaughn commented May 20, 2017

This has been released via 9.7.6

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

Successfully merging this pull request may close these issues.

2 participants