You can do that also into  your template file: [% SET pager = rs.pager %]

Cheers

On Fri, Apr 27, 2012 at 10:30 PM, Kenneth S Mclane <ksmcl...@us.ibm.com>wrote:

> That was the clue I needed. There are a few pieces to this that I could
> not find all in one place. Here is working code for the next poor person
> trying to get this working:
>
> sub list :Local {
>         my ($self, $c, $page) = @_;
>         #needed to add $page to the param array
>         $page = $c->req->param('page') || 1;
>         #then you either get the value from the query or set to 1. I
> removed the "my" as this is declared above.
>         my $rs = $c->model('ORANGES::AccountView')->search_rs(undef, {
>                 order_by => 'account_code',
>                 rows => 15,
>                 page => $page,
>         #I changed this back to use the variable
>          });
>         $c->stash(accounts => $rs);
>         $c->stash(pager => $rs->pager());
> }
>
> and now it works!
>
> Thanks all. I will be back.
>
>
>
>
>  From: Cory Watson <jheep...@gmail.com> To:
> The elegant MVC web framework <catalyst@lists.scsys.co.uk>
> Date: 04/27/2012 03:20 PM Subject: Re: [Catalyst] Paging problem
> ------------------------------
>
>
>
> Alex Povolotsky wrote:
> > On 04/28/12 00:05, Kenneth S Mclane wrote:
> >>
> >>
> >> ok, I tried this:
> >>
> >> my ($self, $c, $page) = @_;
> >>
> >> and my template code is issueing uri's like this:
> >>
> >> http://localhost:3000/accountview/list?page=4
> >> <http://localhost:3000/accountview/list?page=4>
> >>
> >> Do I need to remove this line:
> >>
> >>  my $page = 1;
> > It depends on what do you need. If you want paging to work, you'd better
> > don't hardcode 1st page.
>
> Kenneth,
>
> Note that parameters come from the request:
>
> my $page = $c->req->param('page') || 1;
>
> The form you suggested would be if you were using a page in the path
> (/accountview/list/4) rather than in the query params
> (/accountview/list?page=4).
>
> hth.
>
>
> --
> Cory G Watson
> http://www.onemogin.com
>
>
> _______________________________________________
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
>
>
>
> _______________________________________________
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
>
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to