Skip to content

Commit 321f60e

Browse files
committed
Fixed column ordering
Signed-off-by: Roland Dalmulder <[email protected]>
1 parent d1419dc commit 321f60e

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

administrator/components/com_patchtester/forms/filter_pulls.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@
8686
name="fullordering"
8787
type="list"
8888
onchange="this.form.submit();"
89+
default="pulls.pull_id DESC"
90+
validate="options"
8991
>
9092
<option value="pulls.title ASC">JGLOBAL_TITLE_ASC</option>
9193
<option value="pulls.title DESC">JGLOBAL_TITLE_DESC</option>

administrator/components/com_patchtester/src/Model/PullsModel.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class PullsModel extends ListModel
3939
* @since 2.0
4040
*/
4141
protected $context;
42+
4243
/**
4344
* Array of fields the list can be sorted on
4445
*
@@ -75,7 +76,7 @@ public function __construct($config = [])
7576
parent::__construct($config);
7677
}
7778

78-
protected function populateState($ordering = 'pulls.pull_id', $direction = 'DESC')
79+
protected function populateState($ordering = null, $direction = null)
7980
{
8081
parent::populateState(
8182
$ordering,
@@ -307,6 +308,7 @@ protected function getListQuery()
307308

308309
$ordering = $this->getState()->get('list.ordering', 'pulls.pull_id');
309310
$direction = $this->getState()->get('list.direction', 'DESC');
311+
310312
if (!empty($ordering)) {
311313
$query->order(
312314
$db->escape($ordering) . ' ' . $db->escape($direction)

administrator/components/com_patchtester/tmpl/pulls/default.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020

2121
HTMLHelper::_('stylesheet', 'com_patchtester/octicons.css', ['version' => '3.5.0', 'relative' => true]);
2222
HTMLHelper::_('script', 'com_patchtester/patchtester.js', ['version' => 'auto', 'relative' => true]);
23+
24+
$listOrder = $this->escape($this->state->get('list.ordering'));
25+
$listDirn = $this->escape($this->state->get('list.direction'));
2326
?>
2427
<form action="<?php echo Route::_('index.php?option=com_patchtester&view=pulls'); ?>" method="post" name="adminForm" id="adminForm">
2528
<div class="row">
@@ -43,10 +46,10 @@
4346
<thead>
4447
<tr>
4548
<th scope="col" style="width:5%" class="text-center">
46-
<?php echo Text::_('COM_PATCHTESTER_PULL_ID'); ?>
49+
<?php echo HTMLHelper::_('searchtools.sort', 'COM_PATCHTESTER_PULL_ID', 'pulls.pull_id', $listDirn, $listOrder); ?>
4750
</th>
4851
<th scope="col" style="min-width:100px">
49-
<?php echo Text::_('JGLOBAL_TITLE'); ?>
52+
<?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_TITLE', 'pulls.title', $listDirn, $listOrder); ?>
5053
</th>
5154
<th scope="col" style="width:8%" class="d-none d-md-table-cell text-center">
5255
<?php echo Text::_('COM_PATCHTESTER_BRANCH'); ?>

0 commit comments

Comments
 (0)