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

fix(uiGrid): Wait for grid to get dimensions before rendering #3238

Merged
merged 1 commit into from
Apr 13, 2015

Conversation

c0bra
Copy link
Contributor

@c0bra c0bra commented Apr 8, 2015

This is a fix for #2700 and a few other issues.

The problem here is that for determining the grid width, gridUtil is detecting that when the grid is initialized, it has an offsetWidth of 0, so it creates a "fake" (cloned) element that it attaches to the document with visibility: hidden in order to measure it.

This causes a problem because with width: 100% when attached to the document body the grid will just fill up the whole space. THEN when the real grid is in the modal it takes up way more space than it should.

This change makes the grid wait up to 2 seconds for the element to have a width > 0 before it initializes the dimensions.

Note that this change also has a breaking change, which is that gridUtil can no longer try to get the width of hidden elements, which is the same as jQuery. Hidden elements really don't have any dimension.

If the grid has no width initially, wait for up to 2 seconds for the grid
to be shown and have dimensions. Once that happens it will re-initialize
its height and width and redraw the canvas.

This should fix the problems with the grid taking up too much space in a
modal.

BREAKING CHANGE: gridUtil will no longer calculate dimensions of hidden
elements
@c0bra c0bra force-pushed the fix-grid-in-modal branch from 8b70a3a to e7dfb8c Compare April 8, 2015 21:02
@c0bra
Copy link
Contributor Author

c0bra commented Apr 13, 2015

I'm going to go ahead and merge since there's no feedback either way.

c0bra added a commit that referenced this pull request Apr 13, 2015
fix(uiGrid): Wait for grid to get dimensions before rendering
@c0bra c0bra merged commit 382f936 into master Apr 13, 2015
@c0bra c0bra removed the in progress label Apr 13, 2015
@JLLeitschuh JLLeitschuh deleted the fix-grid-in-modal branch January 19, 2016 17:43
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.

1 participant