Posted by caiosba on January 1, 2013 at 4:28pm
8 followers
| Project: | Views |
| Version: | 7.x-3.x-dev |
| Component: | Miscellaneous |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
| Issue tags: | Needs manual testing |
Issue Summary
I have a view that loads other views. Both views, the parent and the nested ones, have Ajax enabled and have pagination. When a click to go to another page inside a nested view, the parent view is updated. This happens because the events are attached by the outermost parent/view, and not by the closest parent/view. The attached patch seems to fix this bug.
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| views-ajax-pager-closest-parent.patch | 1.66 KB | Idle | PASSED: [[SimpleTest]]: [MySQL] 1,603 pass(es). | View details | Re-test |
Comments
#1
So it seems to be already token into account that there is a problem with nested views, so i'm wondering why does the current code not work?
#2
The previous patch used
jQuery.is()with an object which is not supported until jQuery 1.6. This patch uses object equality comparison, which is valid for DOM elements.#3
The last submitted patch, 1877446-3-views-ajax-pager-closest-parent.patch, failed testing.
#4
The correct patch.
#5
I had similar issue with Ajax-loaded Views #1911582: Pager not working on Ajax-loaded Views.
Patch #4 fixed it. Thanks a lot.
#6
Re-assigning to test.
#7
+++ b/js/ajax_view.jsundefined
@@ -94,6 +85,8 @@ Drupal.views.ajaxView.prototype.attachPagerAjax = function() {
+ if (!$link.closest('.view').is(this.$view)) return;
+++ b/js/ajax_view.jsundefined
@@ -86,7 +86,7 @@ Drupal.views.ajaxView.prototype.attachPagerAjax = function() {
+ if ($link.closest('.view')[0] != this.$view[0]) return;
Please use {}, as we don't use such code snippets in drupal.
#8
Please check the attached patch, now using {}.
#9
The last submitted patch, 1877446-3-views-ajax-pager-closest-parent.patch, failed testing.
#10
#8: 1877446-3-views-ajax-pager-closest-parent.patch queued for re-testing.
#11
Quick note that this patch completely broke AJAX on a views block with a summary pager attachment using AJAX.
#12
I'm glad that you found this while testing it! You saved a lot of sites just by posting this comment. Thank you!
#13
Thank you for posting this caiosba I was having this issue with the Load More pager. I had this working fine on a node that had an embedded View. But then (for reasons that I won't bother to explain!) I loaded this node in a nodequeue View and the pager just stopped working with Ajax. This patch got it working. Life saver! Thanks.
I was using Views version 7.x-3.6