Is there a chance that Views Infinitiv Scroll will work with ajax enabled views in the near future?
It would be a real killer feature!

Thanks a lot!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Remon’s picture

Title: Infinitiv scrolling for ajax views » Compatibility with Views Ajax feature
Stolinski’s picture

+1 This feature is essential.

DerekL’s picture

+1

I would be great to not have to pick between exposed forms and infinite scroll.

xopoc’s picture

+1

kbeck303’s picture

Priority: Normal » Major

I'm also looking for a solution for infinite scrolling and ajaxed better exposed filters. It's a bummer you can't have views Ajax enabled while infinite scrolling is turned on.

kbeck303’s picture

I found a different solution for having views Ajax enabled (for ajax filters) and using an infinite scroll option.

I used Views Load More module (NOTE: you have to use the DEV version, which has the Waypoints module integration otherwise the infinite scroll doesn't work.)
- http://drupal.org/project/views_load_more
- http://drupal.org/project/waypoints

doliveros’s picture

Damn! Spent a whole day hacking my way through views infinite scroll just to make it work with an ajaxified faceted view. Oh well, it's nice to know there's already a way to accomplish this.

cwithout’s picture

I have a patch almost ready that makes the module compatible with views ajax (and adds the iphone compatibility mention in #1180962: iPhone compatibility). Both iPhone and AJAX support require additions to the Autopager plugin, which I added here https://github.com/cristinawithout/jquery-autopager-too.

Before I submit the patch, I have a question for the maintainer(s). Would you prefer that I have the module check for the existence of the newer version of the plugin and fall back to the old. (Which will require more file_exists() checks and a setting value passed to JS to determine if the site is running a version compatible with ajax or not.) Or would you prefer I change the module to *just* support the newer version and add an update hook with a message like "You must update to the jQuery Autopager Too plugin. Download and place this file into sites/all/libraries/autopager or download it using drush dl-autopager."

The latter option (supporting only 1 version) keeps the code cleaner, and is what I would prefer, but I don't want to be too presumptuous in changing the module's supported plugin.

cwithout’s picture

So I don't leave this half finished and have to figure out later where it left off, I just finished up the patch requiring the new plugin. I can revisit it later if maintainer(s) would prefer to have the fallback code.

Please test for views ajax compatibility. Instructions for updating the jquery plugin are contained within the patch and can be found from the update.php or status report (admin/reports/status) pages.

cwithout’s picture

Status: Active » Needs review

Updating status.

paveq’s picture

Status: Needs review » Reviewed & tested by the community

This patch seems to work fine.

funkDoc’s picture

Thanks for this patch, works great with ajax now for me. Also fixed the loading in iphones, I think from the updated jquery script.

kietnguyen’s picture

The patch on #9 works great. Thank you.

aabdullahh’s picture

thanks... I don't use drush

can you provide me with a simple patch

with regards

cwithout’s picture

@aabdullahh The patch is in #9. You don't need to use Drush to use the patch, but the patch does address the module's existing Drush integration.

ryan.gibson’s picture

Status: Reviewed & tested by the community » Needs work

Apologies if this is unrelated, should be addressed after the patch is committed, or isn't related to a problem in this module/patch.

The patch applied cleanly and ajax can now be enabled.

If you take a look at my site -> Development Site and at the right sidebar. You'll see that I've got a view that scrolls that has a Disqus comment count field. The comment counts work on the initial load, but when scrolling and loading more, it doesn't work, only "comments" appear. I thought ajax would do the trick, but it is still a no go.

Again, if this isn't something the ajax is meant to fix then please place this back to RTBC.

lavamind’s picture

Is this patch supposed to work when using exposed filters? I've tried it and the form disappears after submitting...

Sorry, the patch works fine with exposed filters, my CSS was just in the way!!

DenEwout’s picture

I applied the patch but I'm still having some problems when using exposed filters (using Better Exposed Filters and default exposed filters) and ajax enabled.

When changing the filter options, the view changes correctly but the infinite scroll doesn't work anymore. (export of my view)

drupalina’s picture

Is the patch in#9 included in the latest dev?

I applied the patch manually (line by line). Uninstalled it, then reinstalled it. And now all I get is a simple pager:
1 of 3››
although inside my View settings it says "Infinite scroll"

Fulgrim’s picture

sorry #9 does not work for me

loganphp’s picture

#6 works for me.
I am using following modules together.
- http://drupal.org/project/views_load_more
- http://drupal.org/project/waypoints
- https://drupal.org/project/search_api_ajax
It combination works good.

ransomweaver’s picture

Here's a different approach that may appeal so some in fixing this problem, and would be an easy integration for the maintainers.

I have infinite scroll views that are updated via ajax using the nodejs_views module. Its not a requirement that these views be set to ajax in views. Mine aren't. I had the same problem that after the ajax reload, it shows the pager and the infinite scroll js doesn't run.

My solution is to use the livequery plugin: https://github.com/hazzik/livequery/

in views_infinite_scroll.js the infinite scroll is initialized like this:

 if(!use_ajax) {
    var view_selector = 'div.view-id-' + settings.view_name + '.view-display-id-' + settings.display;
   var content_selector = view_selector + ' > ' + settings.content_selector;

With the livequery plugin its a one-liner to change it so that it will re-initialize when the DOM is updated:

 if(!use_ajax) {
    var view_selector = 'div.view-id-' + settings.view_name + '.view-display-id-' + settings.display;
    $(view_selector).livequery(function() {
       var content_selector = view_selector + ' > ' + settings.content_selector;
     ....
    });

I haven't tested with regular ajax views.You'd just have to remove the code that checks if its ajax.

scapegoat17’s picture

Issue summary: View changes

I do not believe this patch is working with exposed filters. On page load, it seems to be loading the pages correctly every single time. When I do an exposed filter search, this no longer works when scrolled to the bottom. It seems that the scroll event is not even attached anymore and the attach function is no longer there.

Has anyone found a solution for this?

Sam152’s picture

I have a working patch for this issue which also includes the patch from #1316194, to allow you to load more content with a button. It's still in early stages and there are a few things that could stand to be cleaned up on the JS side of things, but it's a working solution for my immediate requirements.

Anonymous’s picture

FileSize
10.13 KB

Re-rolled patch against git code so it doesn't break on the .info file.

Anonymous’s picture

FileSize
10.2 KB

Fixed bad manual patch errors with js file.

Sam152’s picture

Attached another reroll of the above to fix some whitespace errors and remove a stray console.log.

Sam152’s picture

Another bug fix related to where the content is loaded.

nishant_k’s picture

FileSize
17.37 KB

Its views infinite scroll module which is compatible with views ajax feature. All the work is done by cwithout and Sam152. I just compiled it. And its working for me.

jienckebd’s picture

#29 works -- also comes with the required library.

  • Sam152 committed 830f280 on 7.x-1.x
    Issue #1335792, Issue #1316194 - AJAX compatability, manual load button.
    
Sam152’s picture

Status: Needs work » Fixed

This fix has been fixed in the last dev release and will likely be tagged in a stable release over the next few weeks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

kopeboy’s picture

Version: 7.x-1.x-dev » 7.x-1.1
Status: Closed (fixed) » Patch (to be ported)

Can you include this in a stable release?

Anonymous’s picture

I believe I have the stable release of views infinite scroll (Views Infinite Scroll 7.x-1.1) and still have the warning "Views infinite scroll pager is not compatible with Ajax Views. Please disable "Use Ajax" option" So I guess this is not yet in stable.

I'll install dev though.

Anonymous’s picture

The autopager library is still missing and needed to be added manually from the dev version.
I added another patch file for version 1.1, created from #29 zip file - so it can be added in project.make file.

edutrul’s picture

Susbcribe!

deepakrmali’s picture

Subscribe...

miccelito’s picture

Above patch #29 is solving the ajax issue with Views exposed filters only. Is that right?

There might be more cases beside exposed filters when ajax functionality is needed for a views display i.e. Drupal Commerce product list page where "Add to cart" buttons are ajaxfied, but wont work if Views Infinite Scroll is enabled. Well, just to say. But I guess Views exposed filters was prio issue for Infinite Scroll..

miccelito’s picture

These may be related:
AJAX do not work with Quicktabs module https://www.drupal.org/node/2185999
ajax cart not working for several product views in a page https://www.drupal.org/node/2357855

I.e. Quicktabs may have similar issue as Views Infinite Scroll with ajax content.
Mentioned there may other ajax elements than just Exposed filters, i.e. "add to cart" forms.

Normally those forms would have the action="/" and the input (type="submit") would have the extra class 'ajax-processed' when Views ajax is enabled.
But when scrolling down with Views Infinite Scroll this doesn't happen but instead form action="/***?page=1" etc and doesn't add the class 'ajax-processed' to input tag.

Does anyone have a clue how to solve this? Maybe can be solved in the 'views_infinite.js' file? Somewhere at line 4..

Drupal.behaviors.views_infinite_scroll = {
    attach: function (context, settings) {
// Modification here

  • Sam152 committed 830f280 on 7.x-2.x
    Issue #1335792, Issue #1316194 - AJAX compatability, manual load button.
    
Honza Pobořil’s picture

Status: Patch (to be ported) » Closed (outdated)