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

Scroll up not propagating to parent when at top of "short" grid #3340

Closed
GauravButola opened this issue Apr 22, 2015 · 11 comments
Closed

Scroll up not propagating to parent when at top of "short" grid #3340

GauravButola opened this issue Apr 22, 2015 · 11 comments

Comments

@GauravButola
Copy link

I've created this plunk[1] to show the bug.

Scroll down while keeping your mouse inside the grid, keep your mouse in grid and, now try to scroll up.
This bug doesn't seem to appear in the 3.0.0-rc.19 release.

Is there a solution to this in the latest 3.0.0-rc.20 release?

[1] http://plnkr.co/edit/ke8jCXG7qsOzWRqOsrw1?p=preview

@PaulL1 PaulL1 changed the title Scroll up not working in grids which don't have scrollbar. Scroll up not propagating to parent when at top of "short" grid Apr 22, 2015
@PaulL1
Copy link
Contributor

PaulL1 commented Apr 22, 2015

This is working on the tutorial: http://ui-grid.info/docs/#/tutorial/101_intro, I assume it's a difference between rc20 and unstable, and is therefore already fixed in unstable.

@PaulL1 PaulL1 added this to the Future milestone Apr 22, 2015
@GauravButola
Copy link
Author

Thanks for the quick response @PaulL1. So, I guess I should downgrade to 3.0.0-rc.19 until new version is released.

Thanks for the awesome work :)

@PaulL1
Copy link
Contributor

PaulL1 commented Apr 22, 2015

I'd be more inclined to upgrade to unstable, there's quite a bit in there. I can't recall what other bugs you're inheriting by going back to rc19.

@GauravButola
Copy link
Author

Ah! then it'll make sense to use the unstable. What would you say is the best way, to get the unstable version? Right now I'm getting the rc20 from bower.

@PaulL1
Copy link
Contributor

PaulL1 commented Apr 23, 2015

Easiest to get it from ui-grid.info/release. Check the tutorials for links.

You can also clone the repo and build, but that's a bit fiddlier.

Sent from my iPhone

On 23 Apr 2015, at 5:03 pm, Gaurav Butola notifications@github.com wrote:

Ah! then it'll make sense to use the unstable. What would you say is the best way, to get the unstable version? Right now I'm getting the rc20 from bower.


Reply to this email directly or view it on GitHub.

@GauravButola
Copy link
Author

Great! thanks for your help.

@Kidsisker
Copy link

I am implementing the latest version and I am also experiencing this issue. I have several small grids on a page (<= 10 rows) and the user is unable to scroll up while mouse is over the grid. The vertical scrollbar is disabled. I do also notice that this issue can be reproduced on the tutorial that you sited above. Any updates? I have just finished a massive refactor so I am not overly concerned about this issue, but my users might. Thanks so much!

@Jacquelin
Copy link

Hi, I am also experiencing this issue. And it doesn't work on http://ui-grid.info/docs/#/tutorial/101_intro .
This problem can be reproduced on a grid that has no scroll bar activated (canvasHeight < viewportHeight)

I have tried to debug on the last unstable version (RC21). I have added some comment, if it helps you to find what's wrong, I don't want to try to presume what the problem ...

Code from uiGridRenderContainer directive declaration, 'gridUtil.on.mousewheel'

if (event.deltaY !== 0) {
    // On scroll up, scrollYAmount < 0 (-53 for me). On scroll to bottom, scrollYAmount > 0 
    var scrollYAmount = event.deltaY * -1 * event.deltaFactor;

    scrollTop = containerCtrl.viewport[0].scrollTop; // scrollTop === 0
    // Get the scroll percentage
    // -- scrollTop + scrollYAmount < 0 (-53 for a scroll up)
    // -- rowContainer.getVerticalScrollLength() < 0 (-299 for a grid height of 300px)
    var scrollYPercentage = (scrollTop + scrollYAmount) / rowContainer.getVerticalScrollLength();
    // -- 0 < scrollYPercentage < 1, but the scroll Y percentage should be 0, no ? 

    // -- If it's a scroll to bottom, the scrollYPercentage will be < 0 (
    // -- so scrollPercentage will be equal to 0

    // Keep scrollPercentage within the range 0-1.
    if (scrollYPercentage < 0) { scrollYPercentage = 0; }
    else if (scrollYPercentage > 1) { scrollYPercentage = 1; }

    scrollEvent.y = { percentage: scrollYPercentage, pixels: scrollYAmount };
}
// [...]
// Let the parent container scroll if the grid is already at the top/bottom
if (event.deltaY !== 0 && (scrollEvent.atTop(scrollTop) || scrollEvent.atBottom(scrollTop))) {
    // -- It doesn't enter here if it's a scroll up
} else {
    event.preventDefault();
    // [...]
}

I hope this will help you ...

Oh and thanks for this module !

PS :

  • ui-grid version : 3.0.0-RC21
  • Chrome version 42.0.2311.135

@tmarkley
Copy link

Running into the same issue using the unstable release from yesterday (v3.0.0-rc.21-c0d9b48).

@villelahdenvuo
Copy link

👍 For this issue, I can't scroll my page up at all because I have a 100% width table.

@Jacquelin
Copy link

The scroll down have some issue too. I make some test :

  • If the canvas is smaller than the view port, and there's no scroll : my first PR can handle this case.
  • If the canvas is smaller than the view port, and there's a scroll : this case is a real problem, indeed, the code calculate a scrollYPercentage equal to 0, even is the scroll is at the bottom. (http://plnkr.co/edit/Xoianpl2wWSKuQVtuxOt?p=preview)
  • If the canvas is bigger than the view port : no problem

I make a new PR (#3666) to ensure all case

swalters added a commit that referenced this issue Jun 19, 2015
thanks to @500tech-user and @Jacquelin for PR's that led to this fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants