Problem/Motivation

When use exposed form in block and after first form change ajax scroll not working, but after second and more form changes everything is fine.

Remaining tasks

The patch is ready for review.

Comments

zviryatko created an issue. See original summary.

zviryatko’s picture

sam152’s picture

Status: Active » Postponed (maintainer needs more info)

I can't reproduce this. I've tried an exposed form in a block and both the manual and automatic infinite scrolling work as expected after input for every time the form is submitted.

Can you provide more detailed steps on how to reproduce or maybe post your view?

zviryatko’s picture

  1. Clear install with standard profile
  2. Enable this module and devel generate
  3. Generate few nodes of type article and terms from tags vocabulary with devel generate
  4. Edit default Frontpage view (/node) set pager as View infinite scroll with default settings and add filter by field_tags, make it exposed and set allow multiple selection. Save views and go to /node page
  5. Select all values in exposed form and click to apply first time, scroll to the end of view and... in this step nothing happened for me. If you click to apply second time everything will be fine

Tested in Iceweasel (firefox for debian) 43.0.2 and in chromium 47, debian 8.2 x64.
Btw, show form in block is not required, I can reproduce bug even with inline exposed form.

Here is the link to simplytest https://rml0y.ply.st/node, but it will be work only one day.

zviryatko’s picture

In this morning I've found that the bug not work when you use End button or click to end of scroll bar.
Here is link to video with demonstration - https://dl.dropboxusercontent.com/u/12457762/screenshot/out.ogv

sam152’s picture

Status: Postponed (maintainer needs more info) » Needs work

Thanks for adding more info. I will have a look shortly.

sam152’s picture

Status: Needs work » Needs review
StatusFileSize
new1.88 KB

Thanks for your patch. I've tested, reproduced and verified that it does indeed fix the problem.

The reason this was a problem in the first place is because when AJAX filters were applied, duplicate events were bound to 'scroll.views_infinite_scroll'. One old one with a reference to a $pager element that no longer existed and one correct one bound to the new pager returned by the AJAXed view.

When the $pager offset was checked, it returned 0 for the broken reference (indicating it was at the very top of the page) and a click was triggered on the old pager and the 'scroll.views_infinite_scroll' event was unbound from BOTH pagers (the real one and the non-existent one).


Instead of this fix I propose removing the the event in the detach handler, meaning there is never a broken $pager reference and event to begin with.

Can you apply and review the current patch? If it works for you and you're happy with the approach I can commit it and create a new release.

zviryatko’s picture

Status: Needs review » Reviewed & tested by the community

I've checked and it works for me.

sam152’s picture

Status: Reviewed & tested by the community » Fixed

  • Sam152 committed c95631d on 8.x-1.x authored by zviryatko
    Issue #2649470 by zviryatko, Sam152: Not working with ajax exposed form...
sam152’s picture

Thanks your your contribution.

Status: Fixed » Closed (fixed)

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

kashandarash’s picture

Ajax scroll works but only one time.
If I change "$window.on(scroll_event, ..." to regular "$window.on('scroll', ..."
everything works.
I have the same configurations as zviryatko wrote.

kashandarash’s picture

Status: Closed (fixed) » Needs work
sam152’s picture

Status: Needs work » Closed (fixed)

Please open a new issue, try the latest version and provide some further details. I can't reproduce #13.