Scroller pagination issue: offset always 0
Scroller pagination issue: offset always 0
Scroller pagination has always bit a bit of a mystery to me. I'd like to be able to configure that page size, it appears to guess the page size based on some hueristic.
Regardless, that's not really my problem. When scrolling through
it works fine, you can see in the console that the offset changes.
But when selecting Symfony 7 and marking=valid
https://packages.survos.com/?marking=valid&symfonyVersions=7.0 (alas, due to an unrelated but, query string parameters aren't auto-selecting the facets, so to see the error you have to open the searchPanes and select these 2).
Now scroll through, and and the debug line shows the offset as always 0, so it never gets beyond 135.
I think this use to work, but may not. It seems to work without the facet searches, so maybe I'm encoding something wrong? Or maybe related to the sort?
Answers
I made a 45-second video to show the problem: https://www.awesomescreenshot.com/video/26297260?key=16f4eaa82bba8a918a37d2a83cb61fd1
Hi,
Thanks for the link and video.
The number of rows that Scroller selects to get and display is based on
scroller.displayBuffer
. That is basically the number of rows that fit into the viewport multiplied by that fixed factor.This is the code that does that.
Regarding the offset, I'll need to come back to that. I'm traveling this week, so it will probably be next week before I get a chance to have proper look at it.
Allan
Thanks -- that explains why when I open the console debugger the number of rows requested changes!
I'm still stuck on the offset, I'd be grateful if you got a chance to look at it. Thanks.
Perhaps there's a version out of sync, I found this when trying to upgrade everything.
Hi, any suggestions on where I can look to solve this?
That doesn't make a particularly huge amount of sense to me. 2.0.3 should be included in that range I thought. I understood it to be 1.11.* through 2.*.
Checking with the npm SemVer Calculator appears to confirm this:
What package manager are you using?
Allan
AssetMapper (from Symfony) which downloads the packages from jsdelivr.
I believe it then scans the downloaded package for dependencies and installs those.
But I'm not sure the problem is the packages, but rather that the callback isn't providing the right offset. Maybe it's a package sync issue, but that might be completely unrelated.
I've added an issue to get rid of the warning in AssetMapper, but I'm almost positive that it's simply a false warning, and not the root of the pagination problem.
https://github.com/symfony/symfony/issues/54610
Are you able to confirm this behavior? I'm stuck on where to even look at this point. I'm wondering if it's something new in version 2, as I think this same code use to work.
Apologies - I was focusing not on the offset issue, but rather the version error. That might well be something in symfony that has different semver handling that node - I'm not sure.
But going back to the offset issue - it looks like you have different row heights in the table, and that isn't valid with Scroller. With Scroller you must have all rows exactly the same height, otherwise it can't perform its virtual scrolling calculations (i.e. it can't say "row x must be exactly at pixel position y, since all rows as height z" and it can't calculate the height of all rows, since 1, it doesn't have all the rows and 2 that would be so slow).
Try adding the
nowrap
class to your DataTable. That will help in that regard (although you'll have thedescription
column hidden by Responsive I'm afraid).I'm not certain that will fix it outright, but it might...
Allan
Indeed, that solves the problem, thanks!
Is there a way to simply lock the row height? I can control the image size (though the images are loaded later, obviously, and that's probably contributing to the mis-calculation of the height).
That is, if I have to lock the height of the row, it should be the maximum height of the thumbnail image. Then I'd like description to simply wrap to the available height and show an ellipsis if it doesn't have the space.
I'm not seeing a thumbnail on the page I'm afraid? However, if you have an
<img>
tag, adding the correctheight
andwidth
attributes will allow it to render in the space correctly.One other thing I've realised - the use of the child rows is going to mess up Scroller as well, since that also takes up vertical space in the scrolling container.
You could use a modal? Or if you only have 1000 rows, I wouldn't bother using Scroller. It if was 10k, then sure, it makes more sense (although paging might work for you instead of scrolling?).
Allan
So I still haven't been able to get rid of the offset=0 error.
go to https://packages.survos.com and select Symfony 7.1 from the left menu (under Symfony). Start scrolling down, eventually it'll become blank and all the offsets will be zero in the network log.
BUT it only happens when there's a filter! It appears to work okay if it's everything.
I have the nowrap class on the table, and have locked all the rows to the same height (2 lines). No images.
Any ideas? This is a glaring issue for us, as the whole system is dependent on datatables and facets.
The row heights are not all the same (I see some which are four lines high, some which are two, some three). When using Scroller, it is a core requirement that all rows be of identical height. The way it works is to say "this is the height of the rows, this is the scroll position, therefore I should show row X". If one or more rows are of different heights, that that equation fails. Scroller has to operate that way since it doesn't have all the rows present to be able to calculate the height of each row.
You need to do one of:
Allan
Is there a css class I can use somewhere to force the rows to be the same height? I thought I was doing this, but I think there are some columns where I'm not doing it correctly.
I see now that while I'm using the .line-limit-2 class on every text column, I neglected to import the css file. DOH.
will applying this class to every column force the rows to be the same size?
Hmm, I may have misunderstood line-clamp and unstyled / inline list.
In particular, where max is greater than the line clamp, this seems to have a taller row.
My idea was to have the items all on the same line, up to a certain number. I've confusing list-unstyled and list-inline, when I tweak this the offset seems to be set okay, maybe clamping and lists don't work as I think they do.
Anyway, thanks for re-iterating that it's row height, if you have any suggestions how to make it happen on a higher level (rather than individual columns), I'd love to hear it.