-
Notifications
You must be signed in to change notification settings - Fork 754
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
Question about lazyload #1169
Comments
Hi @fcferreira29! The lazy load widget combines jquery-scrollstop and jquery_lazyload plugins, so really the widget is adapting those plugins to be used with tablesorter. If you check out the lazy load widget demo you'll see that if you scroll to the bottom, only the visible images after you stop scrolling will load. Hmm, are you saying that the combination of the pager and lazyload is making images load? If so, I think the problem might be the lazy load If that doesn't fix the problem, please provide a demo. |
that solved the problem, now i have another one, using lazyload, you do a search on the filters, and then the images dont load (because i didn't scroll) "scroll" is the event i choose, the same happens when i select the next page of the pager, the images dont load, is there a way to change this? i am using "skip_invisible=true" so its normal the images dont load imediatly, but the visible ones dont eaven apear. |
Try adding this code after initializing tablesorter: $('table').on('filterEnd', function(){
$(window).trigger('scroll');
}); If that works for you, I'll include it in the lazy load widget. |
Hello, i did this instead $('table').on('pagerChange', function(){
$( 'table' ).trigger( 'lazyloadUpdate' );
}); i think this solved the problem, with this, what do you think? (with this the images appear (the ones that are visible on the screen) and when i scroll the othes appear too 👍 Thanks, Fábio Ferreira |
That solution is not working again, it appeared functioning but now is not.....i am trying to figure what changed |
i added this: $('table').on('pagerChange', function(){ this solves the problem, but when i use a filter the images dont load |
In that case, try binding to both: $('table').on('filterEnd pagerChange', function(){
$( 'table' ).trigger( 'lazyloadUpdate' );
}); |
So, actually the "lazyloadUpdate" reinitializes the lazy load plugin... I ended up adding a This change is currently only available in the master branch. I'm not sure yet when I'll push a new release. |
Mottie i did this to solve the problem of the lazyload, tell me what you think of it: $('table').on('pagerChange', function(){
$(window).scrollTop(0);
$( 'table' ).trigger( 'lazyloadUpdate' );
setTimeout(function() {
window.scrollBy(0, 1)
}, 1);
}); The $( 'table' ).trigger( 'lazyloadUpdate' );
setTimeout(function() {
window.scrollBy(0, 1)
}, 1); -> covers the part of not having a scroll (when the number of results is not enought to trigger a scroll. |
So the change to the lazyload widget wasn't working? Hmm, I don't think everyone would be happy using |
i changed window.scrollBy(0,1) to $(window).scroll() and works, Thanks, Fabio FerreiraDate: Fri, 1 Apr 2016 05:33:21 -0700From: notifications@github.comTo: tablesorter@noreply.github.comCC: fcferreira@msn.comSubject: Re: [Mottie/tablesorter] Question about lazyload (#1169)So the change to the lazyload widget wasn't working? Hmm, I don't think everyone would be happy using window.scrollBy(0,1) because it does move the page. Would $(window).scroll() work just as well? If it does, I'll add another scroll trigger inside the "lazyloadUpdate" function. —You are receiving this because you were mentioned.Reply to this email directly or view it on GitHub |
Thanks again! A new update is now available. |
I have another interesting issue to report, when i use the print widget combined with the lazyload the pictures dont show, the thing is, the page loads, and i dont do scroll (so the photos are not loaded (that is natural and normal) when i do print the page (the pictures are not loaded on the print screen) is there a way to load them in the print screen? Thanks, Fábio Ferreira Date: Sun, 6 Mar 2016 09:58:45 -0800From: notifications@github.comTo: tablesorter@noreply.github.comCC: fcferreira@msn.comSubject: Re: [tablesorter] Question about lazyload (#1169)So, actually the "lazyloadUpdate" reinitializes the lazy load plugin... I ended up adding a $(window).scroll() in the code on "filterEnd". This change is currently only available in the master branch. I'm not sure yet when I'll push a new release. —Reply to this email directly or view it on GitHub. |
Hi @fcferreira29! It looks like the lazyload plugin doesn't have a perfect solution yet (see #104). I went ahead and modified the print widget to copy the |
couldn't you just inject a one line script using .ready() to run the print, then it would print either way when the dom is ready, and if lazy load is loaded you could have it scroll the page then run print, that way all images would get loaded? It's just an idea, I haven't seen any of the cod and I don't use lazy loads, but just trying to help spit ball here. |
The dom ready event fires when the all the dom elements are in place. The window load event fires after all images are loaded. The main issue here is that the print preview window doesn't execute any javascript, so you could use The $('.print').click(function(){
$('.lazy')
.each(function(){
var $this = $(this);
$this.attr('src', $this.attr('data-original'));
})
.imagesLoaded(function(){
// all images have loaded
$('#mytable').trigger('printTable');
});
}); |
Hello, that solves the problem of the load of the photos, the only issue is that he loads the photos from every page, is there a way to load only the ones that are on the current page? |
I used this to correct the problem, var isHidden = |
It would be easier to use the $('.print').click(function(){
$('.lazy:visible')
.each(function(){
var $this = $(this);
$this.attr('src', $this.attr('data-original'));
})
.imagesLoaded(function(){
// all images have loaded
$('#mytable').trigger('printTable');
});
}); |
hello, I tried the solution
It works (changing page, scrolling, filtering) but its killing completely the page...i have a table with 4000 users (60x60 img each row) and with this solution the page is very slow in all browsers. The page is much, much faster without the lazy loading...just loading the pictures normally! Is there any better solution? I noticed too that the amount of memory ant time to render the page is exactly the same using or not the lazy loading...wasn't supposed the be much faster? Thanks |
Hi @tropicaldev! Please make sure that the image markup includes the following: <img class="lazy" data-original="images/logo.png" width="300" height="300">
If you still can't get things working, please modify this demo showing the problem. |
im using it like this
i set the src with a spinner to show a spinner before the logo...but with src or not the behaviour is the same if i remove the line $( 'table' ).trigger( 'lazyloadUpdate' ); from the "solution" the page speed improves ( the filtering problem appears ) but it stills much faster just use:
i will try change the demo to demonstrate what im experiencing thanks |
Oh wait, you have all 4000 rows loaded in the table at once? Well then yeah, the Or, maybe things would be better if you set the pager |
i have to lazyload all the content table? there is no solution to just do lazyload on the picture? |
The lazyload plugin only works on images. What I was saying is that when a |
sorry, with the option removeRows = true the page stays more responsive (scrolling, changing page ) but stills very laggy (just doing scroll for instance) I removed the "solution" to check if that was causing the lagginess, but no, the scroll stills somewhat laggy with lazy Not using lazy on images, the scroll is very fluid even with 4000 users |
Sorry Mottie, about this issue again... In your demo you can check that when you sort a column the images aren't loading...it only starts loading when you scroll down to bottom and then scroll up again. Now add this code (using sortEnd) to your demo and check that images load: $('.tablesorter').on('sortEnd', function(){ The problem is that this solution, as we talk before, is not a good because its initializing the plugin everytime and creating lots of lag to the tablesorter (the user experience is degrading over time depending how many interactions are done and how fast) Note that $(window).scroll() does not seem to do nothing so i disabled that line...can you you confirm this? As im experiencing, for tables with alot of rows, user interaction a lot better without lazzy load...yes, dowload all pictures is bad but interaction is super-smoth and thats preferable almost anywhere. This kills completelly the porpose of lazzy as its intended for this kind of situations |
Would you please modify the demo I shared above to show the problem you're encountering. |
Hi Mottie, Thank you for your reply Just run your example and do a sort on the name (before you do any scroll)...you can check that lazzy does not work unless you go to the bottom of the page! now your demo with the "fix" : Do the test you did before and it will "work" right? the "fix" is a no go for tables with many rows/pagers :( |
found the problem! in the configuration im using using event 'scroll' instead of 'scrollstop'...original plugin accepts 'scroll' like you say in your documentation maybe its worth state in your documentation that 'scroll' can be used but can cause lag problems in navigation example using event 'scroll' instead of 'scrollstop' thanks for your patience :) |
Hello guys,
i am having a issue with the lazyload,
i have a table with several pages, and the lazy load works fine on the first page, he calls each image fine, but when i get to the end of the page (scrolling down) all the images on the rest of the pages are loaded on the same time, is this normal?
Thanks,
Fábio Ferreira
The text was updated successfully, but these errors were encountered: