ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

scrollToIfNecessary sets bottomBound as NaN

Open jaskaye17 opened this issue 11 years ago • 9 comments

In ui-grid - v3.0.0-rc.22 I am trying to execute the scrollTo functionality. When I hit line 5280:

var bottomBound = self.renderContainers.body.prevScrollTop + self.gridHeight - self.renderContainers.body.headerHeight - self.footerHeight - self.scrollbarWidth;

the value for 'self.renderContainers.body.headerHeight' is undefined which causes the 'bottomBound' to be set to 'NaN'. It seems like the value used here should instead be 'self.headerHeight' which is used to set the 'topBound' on line 5270.

Am I either incorrect in that the value should be switched or am I doing something else that causes self.renderContainers.body.headerHeight to be 'undefined'?

jaskaye17 avatar Jun 24 '15 00:06 jaskaye17

Don't you want to fix this? 1.5 years have passed since the bug was reported.

sponkrashin avatar Dec 13 '16 11:12 sponkrashin

There are a lot of bugs that meet that criteria right now, but most of the grid team that was here at that time is currently inactive due to being busy. We will try to address this, but first we are trying to sort through our bug back log to weed out things that are not real bugs, or no longer bugs

mportuga avatar Dec 15 '16 14:12 mportuga

@mportuga, I understand you. But it is absolutely bug and it is actual right now. What if I make PR by myself? It will not be so complex.

sponkrashin avatar Dec 15 '16 21:12 sponkrashin

PRs are welcome!

dlgski avatar Dec 15 '16 21:12 dlgski

But what about 3.x version? Do you still support it? I don't use angular >= 1.5 in my app, so I cannot update ui-grid to 4,x.

sponkrashin avatar Dec 16 '16 06:12 sponkrashin

4.0 is for Angular >= 1.4

dlgski avatar Dec 16 '16 14:12 dlgski

@dlgski As I see here, all mentions are about angular >= 1.5. And when I tried to update angular-ui-grid to the latest version, npm installed [email protected] inside angular-ui-grid.

sponkrashin avatar Dec 16 '16 19:12 sponkrashin

hmm, technically version 3.x is no longer receiving updates. So even if you make a PR, it will end up somewhere in 4.x. And I am sorry for the misunderstanding. I do agree that this is a bug, otherwise I would have closed it. What I meant is that the fact that this bug is 1.5 years old, does not guarantee priority. Unfortunately, since we have over 1 thousand bugs right now, it is very hard to prioritize, but we are certainly accepting PRs.

mportuga avatar Dec 22 '16 02:12 mportuga

This bug still appears in 4.0.2.

Looks like scrollIfNecessary() is called whereas refreshCanvas() has not finished is job yet.

The following line, particularly, is wrapped in a $timeout function and may execute after scrollIfNecessary() is actually executed:

…
 if (container.header) {
    var headerHeight = container.headerHeight = getHeight(container.headerHeight, parseInt(gridUtil.outerElementHeight(container.header), 10));
    …

For what it's worth, I have also wrapped the call to scrollIfNecessary() (actually the scrollTo() function which in turn calls scrollIfNecessary()) in a $timeout function, as a workaround.

jljouannic avatar Feb 17 '17 10:02 jljouannic