I have the load more pager installed in a view to retrieve 15 nodes at a time using AJAX. When testing it the first load functions as expected, injecting another 15 nodes onto the page. However subsequent clicks/loads refresh the page with '?page=2' appended onto the URL rather than doing further AJAX injections.

Comments

k.elizabeth’s picture

I am experiencing this exact same issue. I have Ajax enabled, but clicking 'Load More' works only the first click. Subsequent clicks and I am advanced to '?page=2' . Trying to wrap my head around why this may be happening...

{Edit} Updated with the dev version of the module and it seems to work fine now!

ericduran’s picture

Status: Active » Fixed

Yea, views made a change to how they handler the ajax request, we fix this on the dev version.

alan evans’s picture

Hi, I know this issue has been fixed in the latest dev version, but I'm not hugely fond of that fix on 2 accounts:

  1. The CSS class regex could be tightened a little, as we know the format of the ID
  2. There's no real reason why views should not continue to set the same 'views-processed' class when using jQuery once(). I'm going to see if the views project maintainers will consider adding either the same ID as before, or at least some target-able ID so that we don't need this regex approach

I wouldn't reopen this issue for the time being, just a heads up that I'm recommending this class be changed back to 'views-processed' in views, which would mean reverting this fix when that happens.

If my issue on views is accepted, then you could go back to the previous non-regex handling for the -processed class. If my issue gets rejected, then the regex could be tightened a little, given that we know the format of the jQuery once ID (always ends with -processed):

/jquery-once-[0-9]+-processed/

The 0-9 will always be non-zero so can use '+' : "jquery-once--processed" would not be valid for the jQuery once auto-generated ID. The IDs begin at 1 in fact.

If I have time, I'll also look into changing once() so that the auto-generated IDs are retrievable in some way. That's part of the issue here - we can't easily know the auto-generated ID, so have to use the regex to determine the most likely IDs (though, to be honest, the regex is unlikely to ever fail in this limited context).

ericduran’s picture

@Alan Evans I don't think this is the correct issue in regards to that. There's another issue where I talk about the jquery once, and a better approach for the future. I just never implemented that.

Status: Fixed » Closed (fixed)

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

dalguete’s picture

StatusFileSize
new830 bytes

Hey everyone,

I just suffered this problem in a project. I'm posting a patch that may help you overcome this, and hopefully will work in the future if the 'views-processed' class is brought back to live.

dalguete’s picture

StatusFileSize
new979 bytes

Reposting patch, as the previous one was made with Netbeans. For this I used git diff directly. More general.

havran’s picture

This patch fix #1806422 too. Thanks!

-- edit

I try dev version now and this seems fix this problem too.

rooby’s picture

Status: Closed (fixed) » Needs review

If you have a new patch, change the status so the maintainer can see.

rooby’s picture

Status: Needs review » Closed (fixed)

Seems as per #8 that that patch is not needed anymore anyway. Setting back.