$attrs->{collapse} = $collapse;
- if ( $attrs->{page} and not defined $attrs->{offset} ) {
- $attrs->{offset} = ( $attrs->{rows} * ( $attrs->{page} - 1 ) );
+ if ($attrs->{page} && not exists $attrs->{resolved_offset}) {
+ $attrs->{offset} = ($attrs->{rows} * ($attrs->{page} - 1)) +
+ ($attrs->{offset} || 0);
+ $attrs->{resolved_offset} = $attrs->{offset};
}
return $self->{_attrs} = $attrs;
$schema->default_resultset_attributes({ rows => 5 });
is($p->(), 5, 'default rows is 5');
+
+# test page with offset
+$it = $schema->resultset('CD')->search({}, {
+ rows => 2,
+ page => 2,
+ offset => 1,
+ order_by => 'cdid'
+});
+
+my $row = $schema->resultset('CD')->search({}, {
+ order_by => 'cdid',
+ offset => 3,
+ rows => 1
+})->single;
+
+is($row->cdid, $it->first->cdid, 'page with offset');