+sub set_report_generator_sort_options {
+ my ($self, %params) = @_;
+
+ $params{$_} or croak("Missing parameter '$_'") for qw(report sortable_columns);
+
+ my %current_sort_params = $self->get_current_sort_params;
+
+ foreach my $col (@{ $params{sortable_columns} }) {
+ $params{report}->{columns}->{$col}->{link} = $self->get_callback(
+ sort_by => $col,
+ sort_dir => ($current_sort_params{by} eq $col ? 1 - $current_sort_params{dir} : $current_sort_params{dir}),
+ );
+ }
+
+ $params{report}->set_sort_indicator($current_sort_params{by}, 1 - $current_sort_params{dir});
+
+ if ($params{report}->{export}) {
+ $params{report}->{export}->{variable_list} = [ uniq(
+ @{ $params{report}->{export}->{variable_list} },
+ @{ $self->get_sort_spec->{FORM_PARAMS} }
+ )];
+ }
+}
+