Closed (won't fix)
Project:
Drupal core
Version:
7.x-dev
Component:
javascript
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
8 Jun 2007 at 15:59 UTC
Updated:
29 Oct 2014 at 14:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Frando commentedWrite it.
If it's well written, falling back cleanly with no javascript, and something that can be disabled, then I'm sure it will be considered.
Comment #2
alippai commentedSorry...
Are there problems with writing a pager in AJAX, or it's important only for me? :)
Comment #3
RobRoy commentedI'd be very interested in an AJAX pager and think it would be a great addition to the jstools module. I could possibly help with some of the development as well, keep me posted.
Comment #4
Crell commentedThere are several existing jQuery-based "infinite scroll" plugins. I would be very much in favor of a module that made it possible to drop-in one of those and have all table pagers become infinite scroll instead.
Comment #5
alippai commentedhttp://drupal.org/node/145551
IMHO this must be done, before anybody starts working on it :)
Comment #6
nedjoFor ideas, see the implementation in dynamicload.js in the dynamicload module, part of Javascript Tools. Specifically, pagers can be made to load dynamically by calling the method
Drupal.dynamicloadPager.The main limitation of the approach in dynamicload is that it assumes there is a single pager on a page and that loaded content should replace the current content of the main content area. This is appropriate in some cases, but in others will lead to broken results, e.g., when a pager is part of a panel's content and the expected result is that only that panel's content is replaced.
Comment #7
dropcube commentedComment #8
nedjoHere's a patch that introduces AJAX paging with an initial implementation for comments. The throbber-active.gif file goes in misc/.
Approach is:
* wrap paged output in a div that includes an ID for the pager data
* js attaches to link elements in pager div
* AJAX call passes pager data ID
* Rendering tests for this ID in the request and, if set, returns JSON
Comment #9
moshe weitzman commentednitfty - subscribe.
Comment #10
Babalu commentedworks this files with D6 too ?
Comment #11
Anonymous (not verified) commentedbookmark.
Comment #12
nedjo@Babalu: Nope, D7 only.
Here's a refinement. A problem with the previous patch version was that it explicitly called
exit()to terminate the request. This version introduces a new menu constant, MENU_OUTPUT_COMPLETE, that can be returned to indicate that rendering is complete. This constant is returned fromcomment_render()if rendering was done in JSON.node_show()tests for this return value and, if found, returns the menu item request without further rendering.In the previous patch I tried to reuse the Drupal.collapseScrollIntoView method to scroll to the newly loaded pager content but it didn't work. Removed here.
Comment #13
chx commentedWell, already you can omit return (or explicitly return NULL) to omit the theme page call.
if ($comments == MENU_OUTPUT_COMPLETE)feels like a tremendous hack to me. How can comments be a menu constant...Comment #14
nedjo@chx: good point. Reroll returning NULL.
Comment #15
nedjoComment #16
nedjoAdding back scrolling through a simple
Drupal.scrollTo()method to scroll the window to the specified element. This should make for better usability--user is scrolled to the new items (in this case, comments) when they arrive.Comment #17
nedjoSee this blog post for more detail on the approaches in this patch: http://www.civicactions.com/blog/AJAX_pagers_Drupal_7
Comment #18
Crell commentedDoesn't Views 2 implement an Ajax pager? Can't we build off of that?
Comment #19
nedjoGood question. Some explanation:
This patch indeed draws on the one I did for Views 2, but with one important difference. Views 2 exposes a separate callback for AJAX requests, while this patch uses a single callback for both AJAX and non-AJAX requests.
We took that direction in Views for several reasons: 1. views needs to enable AJAX previews, which were already coded for; 2. views may need to be loaded at other than the regular page path (e.g., when views are on a block); 3. the same AJAX loading was needed for multiple purposes--pagers, exposed filters, and more.
So, while drawing on the previous work for Views, I don't think those reasons apply here, and I think it's cleanest to use a single callback rather than introducing a new one custom each time we need AJAX.
Comment #20
starbow commentedI feel mixed. This patch feels pretty limited, but the attempts to provide a more general solution are all bogged down, so maybe limited is the right approach.
Comment #21
nedjoI see this patch as a concrete step toward just those general issues. Sometimes it helps to see the general through the specific.
We have two basic options when implementing AJAX fetching of JSON. One is to provide special callbacks for the AJAX request. That's what I'm trying to avoid in this patch.
The other is to provide a way to use the regular callback to retrieve the specific content requested. Since any number of possible requests could be made at a given path, it's not enough to be able to request "JSON". Rather, we need to make a request like "give me the comment pager results for this node matching these parameters".
For this, I think we need all of the elements in this patch.
Some review of the patch itself would be great. What if anything is missing? How well does this move forward the general problem of enabling more flexible content requests? If there are specific issues with the patch, what are they? How could they be addressed?
Comment #22
Anonymous (not verified) commentedThe last submitted patch failed testing.
Comment #23
quicksketchI'd like to give this a review. Although it might just be more work than it needs to be, the ahah.js file has the ability to work on things other than forms (like the pager links) if the necessary Drupal.settings are added manually. While code reuse is great, at the same time it's nice to have things self contained in JavaScript, especially since we don't yet have JS testing suites.
Comment #24
Gurpartap Singh commented
Comment #25
sunI wonder how much more of Views' functionality we want to duplicate instead of working on Views-in-core.
Comment #26
v8powerage commentedAre there no chances whatsoever to put this into 6.x?
Comment #27
catchNone in core whatsoever. But Views has a very nice ajax pager in contrib, on which this is based anyway.
Comment #28
v8powerage commentedIs this possible that using Views I could implement this ajax pager into topics at forum?
Comment #29
sunComment #31
aren cambre commentedsubscribe
Comment #32
v8powerage commentedNewest ajax comments module has ajax pager it works with advanced forum after very small changes in it's js file.
Comment #33
vikramy commentedsubscribe
Comment #34
xandeadx commentedsubscr
Comment #35
wooody commentedHow are make ajax pager for home page .
Thanks
Comment #36
k.dani commentedThis is one of the most shortcomings of the Drupal. Until this won't be developed, there is a temporary solution:
Drupal 6 + Views + Views Custom Fields: http://www.interworks.com/blogs/carmstrong/2011/12/13/rendering-ajax-pag...
Drupal 7 + Views + Views PHP.
Unfortunetly, the Views PHP only available in dev version, so it may not work properly, i haven't tried yet.
Comment #37
nhtwr400 commentedHi,
my theme_pager_wrapper() function in pager.inc is not call by writing
theme('pager_wrapper', $block_content, $pager_id); in module. Can you please let me know why it is not call.
Comment #38
nod_Let's look back at that once views and blocks & layouts are a bit more advanced.
Comment #39
nod_views is in core. they have that.
Comment #40
nod_Comment #41
maximpodorov commentedWhat about non-Views pagers for Drupal 7?
Comment #42
nod_That's contrib material. I don't think it's realistic to expect that kind of new feature in D7.