use namespace::clean -except => [ qw(meta) ];
-has order_by => (isa => 'Str', is => 'rw', trigger_adopt('order_by'));
+has order_by => (isa => 'Str', is => 'rw', trigger_adopt('order_by'), clearer => 'clear_order_by');
has order_by_desc => (isa => 'Int', is => 'rw', trigger_adopt('order_by'), lazy_build => 1);
sub _build_order_by_desc { 0 };
sub adopt_order_by {
shift->clear_current_collection;
};
+after clear_order_by => sub {
+ my ($self) = @_;
+ $self->order_by_desc(0);
+ $self->clear_current_collection;
+};
+
around _build_current_collection => sub {
my $orig = shift;
my ($self) = @_;
#has paged_collection => (isa => Collection, is => 'rw', lazy_build => 1);
has pager => (isa => 'Data::Page', is => 'rw', lazy_build => 1);
-has page => (isa => 'Int', is => 'rw', lazy_build => 1, trigger_adopt('page'));
+has page => (isa => 'Int', is => 'rw', lazy_build => 1, trigger_adopt('page'), clearer => 'clear_page');
has per_page => (isa => 'Int', is => 'rw', lazy_build => 1, trigger_adopt('page'));
has per_page_max => (isa => 'Int', is => 'rw', lazy_build => 1);
sub _build_page { 1 };
$self->clear_current_collection;
};
+after clear_page => sub {
+ my ($self) = @_;
+ $self->clear_pager;
+ $self->clear_current_collection;
+};
+
around accept_events => sub { ('page','per_page', shift->(@_)); };
#implements build_paged_collection => as {