Not sure if anyone else is having this issue. I didn't see anything posted yet in the issue queue.
I've got 2 different views using the load more button and they are having the same problem. When I click on the load more link the first time, it works as expected, and the view is updated. When I click the load more button a second time, an entire page reload is executed instead of an ajax refresh of the view.
From checking out the code in views_load_more.js, the load more button is getting removed, and then reinserted each time its clicked. My guess is the drupal behaviors aren't getting bound to the load more button.
If you look on line 52 and 53 you see where the button is removed and then added back to the DOM.
wrapper.find('.pager a').remove();
wrapper.find('.pager').parent('.item-list').html(new_content.find('.pager'));
When I comment out those 2 lines, the load more button functions as expected each time its clicked. I haven't dug to deep yet to see if commenting those lines out effect anything else, but it works for my use case.
Comments
Comment #1
jonathanmd commentedIt turns out commenting out those lines doesn't completely fix the issue. When I'm on the last page of the view and click the load more button, the last page is just appended to the bottom. This can happen over and over again.
I'll try and take a look at it again when I have some time.
Comment #2
liborvanek commentedYes, same bug here..
Comment #3
ericduran commentedInteresting, I'll look into this.
Comment #4
ericduran commentedAlso, can you give me more info.
What kind of view style is it. Unformatted, List, Table, etc..
Comment #5
ericduran commentedI'm going to postpone this untill I get more feedback.
I can not reproduce this in any view style, also I can see the behaviors being attached to the pager.
I'll love to fix any bugs so please let me know if this is still a problem in the latest dev version and if so, a little more details to help me debug.
Thanks.
Comment #6
Ghostthinker commentedSame Problem here, no matter what kind of view style, using latest views dev
Comment #7
ericduran commentedcan you tell me more as to how to replicate this I've tried every view style and I don't have this problem.
Are you changing any of the views tpl.
Comment #8
johnste commentedI'm having the same problem with the latest dev version of views. No changes to the views templates have been made.
Exported view (content pane + page, both have the same problem): http://drupalbin.com/20213
All enabled modules: http://drupalbin.com/20212
Comment #9
ericduran commented@johnste, thanks for the feedback, I'll look into this.
Comment #10
ericduran commentedIs everyone else having this problem also using waypoints?
Is anyone having this problem not using waypoints?
Comment #11
Ghostthinker commentedWaypoint or not does not matter here with me. Right behaviour that settings in line ~65 of the js file:
Its always Drupal.settings? the other settings are null. Drupal.behaviors.ViewsLoadMore is not called after an ajax load, only the first time when the page load.
Comment #12
ericduran commentedOk, actually it looks like something change in the latest view. The version I was testing was an old dev.
fixing this now.
Comment #13
ericduran commentedOk, it looks like views is now using jquery once. Which is causing the issue, this should be a small fix. More info in a bit.
Comment #14
ericduran commentedFYI, this is now fixed in the git repo. -- http://drupalcode.org/project/views_load_more.git/commit/95c4866
It'll take a while for it to make it to the -dev release.
Thanks for the feedback and support.
Comment #15
jonathanmd commentedThe patch works for me http://goo.gl/MMHSN
Thanks for patching this and putting the time and effort into this module!
Comment #16
ericduran commented@jonathanmd that site looks awesome, and great use of the module. Do you mind if I link to that site on the prject's home page.
I'm looking to add a Sites User Views Load More section. With links of sites using it.
Please let me know.
Thanks :)
Comment #17
Ghostthinker commented@ericduran thank you so much for your effort. The patch works great.
@jonathanmd your site really looks awesome. Great design and a very nobel purpose.
Comment #18
jonathanmd commented@ericduran Yeah go for it!
I'm working on a technical write up of the site that details how I made it and definitely want to give credit to modules that I used, such as this one.
Comment #19
Tony Finlay commentedI've applied the patch and this still isn't working for me. Is there anything else that has to be done other than patch the views_load_more.js file?
Comment #20
ericduran commented@Tony Finlay you just need to run the lastest version of views and the latest dev version of this module.
Comment #21
Tony Finlay commentedHi Eric thanks for your reply, I've tried using the latest Dev along with Views 7.x-3.0-rc3 and I'm still experiencing the problem in the original post.
I had a template file for the view but I disabled it, cleared caches and still no good.
Bit frustrating to say the least.
Comment #23
kleve commentedWhen do you think this will be merged to the stable version?