#bind to the header column, to enable sorting and also so we can distroy the thread $grid->bindColumns('' => sub { my ($w, $infoHR) = @_; my $column = $infoHR->{-column}; #change the queue status to HOLD while any user interaction is occuring &button_setup('HOLD','Red'); #kill current processing thread print "Thread destroyed\n"; $thr->cancel(); my @entirelist = $grid->get(0,"end"); $grid->delete(0,"end"); #sort selected column if($column =~/0|2/){ @entirelist = sort {$a->[$column] <=> $b->[$column]} @entirelist; }else{ @entirelist = sort {lc$a->[$column] cmp lc$b->[$column]} @entirelist; }; &populate_grid($grid,scalar @goods_issues_headers-1,\@entirelist); });