You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@roller.apache.org by Richard Jones <fu...@gmail.com> on 2007/05/20 16:41:57 UTC

Multiple pagers on a page

Hi,

I'm wanting to have different pagers displayed on the same page
template.  For example displaying the WeblogEntriesPager,
CommentsPager and UsersPager all on the frontpage weblog.  There's no
problem initially displaying them, but when it comes to paging through
then each pager reacts to the same next/prev links (when ?page=1, all
pagers move to the next set of results).

One way I could fix this is to make each type of pager react to a
different query param (e.g.  ?entpage=1&compage=3&usrpage=1) and
extend the *Pagers.java, URLUtilities.java & WeblogPageRequest.java to
handle all the different types of pager.  But that kinda screws-up the
whole Pager model, and adding any new types of pagers wouldn't be so
easy.

So, I was wondering if anyone had some neat idea on how to go about this?

Thanks in advance!

Cheers,

Richard

Re: Multiple pagers on a page

Posted by Richard Jones <ri...@pixyblog.com>.
Hi Dave,

Yep, makes sense and AJAX'ing it would be a cool way to get it
functioning.  I will look at doing this way.

Many thanks,

Richard


On 21/05/07, Dave <sn...@gmail.com> wrote:
> On 5/20/07, Richard Jones <fu...@gmail.com> wrote:
> > I'm wanting to have different pagers displayed on the same page
> > template.  For example displaying the WeblogEntriesPager,
> > CommentsPager and UsersPager all on the frontpage weblog.  There's no
> > problem initially displaying them, but when it comes to paging through
> > then each pager reacts to the same next/prev links (when ?page=1, all
> > pagers move to the next set of results).
>
> We made the assumption that there will only be one pager per page, so
> that's going to be a problem. Instead, you could use Ajax widgets
> instead to add multiple pagable elements to a page. For example,
> here's a pagable Dojo table widget that uses a pager that is not part
> of the main page: http://rollerweblogger.org/roller/page/dojoroller
>
> The pager exists in a separate page that generates JSON data for the
> table, here's the page template that generates the JSON data for the
> table:
>
> #if($model.getRequestParameter("columns") == "true")
>     [{field:"pubTime"}, {field:"title"}]
> #else
>    #set($pager = $model.getWeblogEntriesPager())
>    #set($map = $pager.getEntries()) {
>    #if($pager.nextLink) nextLink:"$pager.nextLink", #end
>    #if($pager.prevLink) prevLink:"$pager.prevLink", #end
>    data: [
>    #foreach($day in $map.keySet())
>       #set($entries = $map.get($day))
>       #foreach($entry in $entries)
>          #if($comma),#else#set($comma = true)#end
>          {id: "$entry.website.handle:$entry.anchor",
>           pubTime: "$entry.pubTime", title:"$entry.title" }
>       #end
>    #end ] }
> #end
>
> And here's what the generated JSON data looks like:
> http://rollerweblogger.org/roller/page/dojoentries
>
> Does that make sense?
>
> - Dave
>
>

Re: Multiple pagers on a page

Posted by Dave <sn...@gmail.com>.
On 5/20/07, Richard Jones <fu...@gmail.com> wrote:
> I'm wanting to have different pagers displayed on the same page
> template.  For example displaying the WeblogEntriesPager,
> CommentsPager and UsersPager all on the frontpage weblog.  There's no
> problem initially displaying them, but when it comes to paging through
> then each pager reacts to the same next/prev links (when ?page=1, all
> pagers move to the next set of results).

We made the assumption that there will only be one pager per page, so
that's going to be a problem. Instead, you could use Ajax widgets
instead to add multiple pagable elements to a page. For example,
here's a pagable Dojo table widget that uses a pager that is not part
of the main page: http://rollerweblogger.org/roller/page/dojoroller

The pager exists in a separate page that generates JSON data for the
table, here's the page template that generates the JSON data for the
table:

#if($model.getRequestParameter("columns") == "true")
    [{field:"pubTime"}, {field:"title"}]
#else
   #set($pager = $model.getWeblogEntriesPager())
   #set($map = $pager.getEntries()) {
   #if($pager.nextLink) nextLink:"$pager.nextLink", #end
   #if($pager.prevLink) prevLink:"$pager.prevLink", #end
   data: [
   #foreach($day in $map.keySet())
      #set($entries = $map.get($day))
      #foreach($entry in $entries)
         #if($comma),#else#set($comma = true)#end
         {id: "$entry.website.handle:$entry.anchor",
          pubTime: "$entry.pubTime", title:"$entry.title" }
      #end
   #end ] }
#end

And here's what the generated JSON data looks like:
http://rollerweblogger.org/roller/page/dojoentries

Does that make sense?

- Dave