1 package Reaction::UI::ViewPort::GridView::Role::Order;
7 has order_by => (isa => 'Str', is => 'rw', trigger_adopt('order_by'));
8 has order_by_desc => (isa => 'Int', is => 'rw', trigger_adopt('order_by'), lazy_build => 1);
10 around build_current_collection => sub {
13 my $collection = $orig->(@_);
16 #XXX DBICism that needs to be fixed
17 if ($self->has_order_by) {
18 $attrs{order_by} = $self->order_by;
19 $attrs{order_by} .= ' DESC' if ($self->order_by_desc);
22 return $collection->where(undef, \%attrs);
25 around accept_events => sub { ('order_by', 'order_by_desc', shift->(@_)); };