[Catalyst] Help with paging
Octavian Rasnita
orasnita at gmail.com
Wed Jul 16 11:42:58 BST 2008
From: "Dermot" <paikkos at googlemail.com>
> Hi,
>
> I'm having issues with paging and could handle some help. I tried
> using the examples in the book but it does quite fit what I'm doing. I
> have a list method like this:
>
> sub list : Local {
> my ($self, $c) = @_;
>
> $c->stash->{items} = [$c->model('MyDB::Items')->all];
> $c->stash->{template} = 'items/list.tt2';
>
> # Arg where is pager?
Try using:
sub list : Local {
my ($self, $c) = @_;
my $items = $c->model('MyDB::Items')->search({},{
page => $page,
rows => 20,
});
$c->stash->{pager} = $items->pager;
$c->stash->{items} = [$items->all];
$c->stash->{template} = 'items/list.tt2';
Octavian
More information about the Catalyst
mailing list