Skip to content
Snippets Groups Projects
Commit 9c7a8386 authored by JediKev's avatar JediKev Committed by Peter Rotich
Browse files

issue: Client Side Column Sorting

This addresses an issue where client side column sorting does not work at
all. This is due to the if/else statement that checks for a REQUEST sort
order and if the REQUEST sort order matches an `$orderWays` array value. The
if statement returns TRUE for DESC and sets the sort order to DESC as it
equals '-' (a dash) but ASC equals '' (an empty string) so it returns FALSE
which fails-over to the else statement setting the sort order to DESC. In
addition, this adds sorting icons the the column headers to make it more
obvious they are sortable.
parent 7e2729cd
No related branches found
No related tags found
No related merge requests found
...@@ -47,7 +47,7 @@ if($sort && $sortOptions[$sort]) ...@@ -47,7 +47,7 @@ if($sort && $sortOptions[$sort])
$order_by =$sortOptions[$sort]; $order_by =$sortOptions[$sort];
$order_by=$order_by ?: $sortOptions['date']; $order_by=$order_by ?: $sortOptions['date'];
if ($_REQUEST['order'] && $orderWays[strtoupper($_REQUEST['order'])]) if ($_REQUEST['order'] && !is_null($orderWays[strtoupper($_REQUEST['order'])]))
$order = $orderWays[strtoupper($_REQUEST['order'])]; $order = $orderWays[strtoupper($_REQUEST['order'])];
else else
$order = $orderWays['DESC']; $order = $orderWays['DESC'];
...@@ -205,19 +205,19 @@ if ($closedTickets) {?> ...@@ -205,19 +205,19 @@ if ($closedTickets) {?>
<thead> <thead>
<tr> <tr>
<th nowrap> <th nowrap>
<a href="tickets.php?sort=ID&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Ticket ID"><?php echo __('Ticket #');?></a> <a href="tickets.php?sort=ID&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Ticket ID"><?php echo __('Ticket #');?><i class="icon-sort"></i></a>
</th> </th>
<th width="120"> <th width="120">
<a href="tickets.php?sort=date&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Date"><?php echo __('Create Date');?></a> <a href="tickets.php?sort=date&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Date"><?php echo __('Create Date');?><i class="icon-sort"></i></a>
</th> </th>
<th width="100"> <th width="100">
<a href="tickets.php?sort=status&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Status"><?php echo __('Status');?></a> <a href="tickets.php?sort=status&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Status"><?php echo __('Status');?><i class="icon-sort"></i></a>
</th> </th>
<th width="320"> <th width="320">
<a href="tickets.php?sort=subj&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Subject"><?php echo __('Subject');?></a> <a href="tickets.php?sort=subj&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Subject"><?php echo __('Subject');?><i class="icon-sort"></i></a>
</th> </th>
<th width="120"> <th width="120">
<a href="tickets.php?sort=dept&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Department"><?php echo __('Department');?></a> <a href="tickets.php?sort=dept&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Department"><?php echo __('Department');?><i class="icon-sort"></i></a>
</th> </th>
</tr> </tr>
</thead> </thead>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment