Skip to content

fixed scrollPercent calculation for GridRenderContainer and InfiniteScroll Feature #5395

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

Closed
wants to merge 1 commit into from

Conversation

vance
Copy link

@vance vance commented May 10, 2016

fixed scrollPercent calculation for GridRenderContainer and InfiniteScroll Feature

fixes for
#5211
and
#4508

@@ -22,6 +22,16 @@
*/
module.service('uiGridInfiniteScrollService', ['gridUtil', '$compile', '$timeout', 'uiGridConstants', 'ScrollEvent', '$q', function (gridUtil, $compile, $timeout, uiGridConstants, ScrollEvent, $q) {


// not sure where to put this util function @vance
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could move this to the GridRenderContainer class

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vance Are you planning on taking @swalters's suggestion?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ehh. splitting time between a fortune 500 a startup and marketing my own side-app at the moment. I don't know the next time I will have the headspace to compile this again, christmas time?

@jrthib
Copy link

jrthib commented Jul 17, 2016

Any news on this fix? One of my applications seems to be affected by it.

@hexaclock
Copy link

Any word on this getting merged into master?

@vance
Copy link
Author

vance commented Aug 9, 2016

I'll take this as a compliment. Seems like the PR is just dinged for being complex? I'm not sure how to make a less-complex fix for one of the most complex parts of this library. It took 2 days to get my brain into the space where I could understand the problem, let alone fix it. There's no way I could refactor it now, if that's even possible to do so without increasing the complexity. So, does the project want to fix a fatal bug that essentially breaks all expandable row templates, or reject a PR because it is complex? I'm not sure, I don't maintain libraries of this size.

@vance
Copy link
Author

vance commented Aug 9, 2016

For anyone in a pinch, i made a gist of the compiled code. I've been using this fix in production for weeks with no issues.

@mportuga
Copy link
Member

@vance Can you please fix unit tests?

@vance
Copy link
Author

vance commented Sep 21, 2016

Does CI not run the tests? Er, what tests are breaking?

I tried running grunt dev, grunt dev --browsers=Chrome and I see karma launches a bunch of chromes, but I don't see anything happening.

@cs45977
Copy link

cs45977 commented Oct 3, 2016

Any news on this PR?

@vance
Copy link
Author

vance commented Oct 3, 2016

I see the removed needs fixed test... I don't recall any tests breaking. I did not have time to add new tests as I already went over my budget fixing this. But I don't think that should prevent a merge. Anyone else besides me manually verify correctness of the expanded row calculations? I'm running this in prod with no issues.

@cs45977
Copy link

cs45977 commented Oct 5, 2016

@vance In your Gist:
It looks the file is truncated. Anyway you can provide me your full file?

@vance
Copy link
Author

vance commented Oct 5, 2016

Oh, sorry. I guess Gist has a limit of about 1MB. I put it on my server, here:

http://www.foreverscape.com/angular-grid-ui-exp-fix.js
It's github pages, anyway, haha.

@cs45977
Copy link

cs45977 commented Oct 15, 2016

Bump @mportuga
It looks like this should be merged ... complex solution for a complex problem
no?

// var totalNumRowsToRender = Math.min(rowCache.length,rowIndex + minRows + self.grid.options.excessRows);

//TODO: @vance calculate and appropriate end... doesn't break things, just show more rows than necessary here.
var rangeEnd = rowCache.length;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Showing more rows than necessary is considered a defect for some companies. Can you describe what you mean by that? Will the scrolling end, or will it just keep going since this is the infinite scroll library?


self.updateViewableColumnRange(newRange);
// Define a max row index that we can't scroll past
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code seems to be describing a max column index, not a max row index.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not added by me, maybe moved.

if (!(typeof(scrollTop) === 'undefined' || scrollTop === null)) {
// Have we hit the threshold going down?
if ( !self.grid.suppressParentScrollDown && self.prevScrollTop < scrollTop && rowIndex < self.prevRowScrollIndex + self.grid.options.scrollThreshold && rowIndex < maxRowIndex) {
console.log('returning first bail');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should comment this out, we don't want the grid logging this in production.

}
//Have we hit the threshold going up?
if ( !self.grid.suppressParentScrollUp && self.prevScrollTop > scrollTop && rowIndex > self.prevRowScrollIndex - self.grid.options.scrollThreshold && rowIndex < maxRowIndex) {
console.log('returning second bail');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should comment this out, we don't want the grid logging this in production.

@ionutb
Copy link

ionutb commented Nov 2, 2016

vance, I can't thank you enough, that fix was critical to our project. I hope the patch will be merged soon.

@mportuga
Copy link
Member

mportuga commented Nov 7, 2016

@dlgski This appears to be good and it will fix a big issue for many people. Since we are planning a major update, maybe now is the time to take this?

@mportuga
Copy link
Member

@vance Can you resolve merge conflict?

@vance
Copy link
Author

vance commented Nov 21, 2016

Nope. It took me two full days to solve this. I was told to fix tests that
weren't broken. I was told to fix cyclomatic complexity by a
robot....several months later. I made this fix MONTHS ago, I don't even
remember now it works now. Maybe in January I will have some time.

On Wed, Nov 16, 2016 at 10:35 AM Marcelo Sauerbrunn Portugal <
notifications@github.com> wrote:

@vance https://github.com/vance Can you resolve merge conflict?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#5395 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAI4PxBj1QQXGY_IK6OYpW9mrwy1jK7uks5q-00KgaJpZM4IbkpZ
.

@mportuga
Copy link
Member

mportuga commented Dec 5, 2016

Closing since the developer needs more time to fix it up.

@mportuga mportuga closed this Dec 5, 2016
@BPoorey
Copy link

BPoorey commented Mar 7, 2017

Any updates on this?

@nonongodup
Copy link

nonongodup commented Aug 2, 2018

any updates on merging this ? my application is affected by the same issue. it would be good if you can merge. this would solve problem to many.

@mportuga
Copy link
Member

mportuga commented Aug 5, 2018

This was closed due to inactivity, i will reopen and see if I can finish the work

@mportuga mportuga reopened this Aug 5, 2018
@mportuga
Copy link
Member

mportuga commented Aug 6, 2018

After reviewing this code, I realized that it does not actually address the problem in an acceptable way. All this code really does in the end is get rid of the virtualization, which would be horrible for performance.

@mportuga mportuga closed this Aug 6, 2018
@nonongodup
Copy link

It does affect the efficiency. with this code the page loading become little slow. Is there any other solution for this issue?

@mportuga
Copy link
Member

mportuga commented Aug 6, 2018

None that I am aware off, and unfortunately, I don't know when I will have enough time to look at this more throughly. I will certainly accept other pull requests if someone else finds it, but for the next couple of weeks, I will be traveling out of the country, followed shortly by moving to a new place, so I won't have much time to look into ui-grid.

@nonongodup
Copy link

@mportuga any update on this bugs ?


} else {
var maxLen = self.visibleRowCache.length;
newRange = rowCache.length;//[0, Math.max(maxLen, minRows + self.grid.options.excessRows)];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mportuga This is the line you were looking for

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means that this PR is invalid. It simply removes the virtual scrolling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.