diff --git a/administrator/components/com_patchtester/forms/filter_pulls.xml b/administrator/components/com_patchtester/forms/filter_pulls.xml index 1b83eb2..d819a50 100644 --- a/administrator/components/com_patchtester/forms/filter_pulls.xml +++ b/administrator/components/com_patchtester/forms/filter_pulls.xml @@ -86,6 +86,8 @@ name="fullordering" type="list" onchange="this.form.submit();" + default="pulls.pull_id DESC" + validate="options" > diff --git a/administrator/components/com_patchtester/src/Model/PullsModel.php b/administrator/components/com_patchtester/src/Model/PullsModel.php index 0b6143a..58d9b00 100644 --- a/administrator/components/com_patchtester/src/Model/PullsModel.php +++ b/administrator/components/com_patchtester/src/Model/PullsModel.php @@ -39,6 +39,7 @@ class PullsModel extends ListModel * @since 2.0 */ protected $context; + /** * Array of fields the list can be sorted on * @@ -75,7 +76,7 @@ class PullsModel extends ListModel parent::__construct($config); } - protected function populateState($ordering = 'pulls.pull_id', $direction = 'DESC') + protected function populateState($ordering = null, $direction = null) { parent::populateState( $ordering, @@ -307,6 +308,7 @@ class PullsModel extends ListModel $ordering = $this->getState()->get('list.ordering', 'pulls.pull_id'); $direction = $this->getState()->get('list.direction', 'DESC'); + if (!empty($ordering)) { $query->order( $db->escape($ordering) . ' ' . $db->escape($direction) diff --git a/administrator/components/com_patchtester/tmpl/pulls/default.php b/administrator/components/com_patchtester/tmpl/pulls/default.php index a1051af..6b5085d 100644 --- a/administrator/components/com_patchtester/tmpl/pulls/default.php +++ b/administrator/components/com_patchtester/tmpl/pulls/default.php @@ -20,6 +20,9 @@ use Joomla\CMS\Router\Route; HTMLHelper::_('stylesheet', 'com_patchtester/octicons.css', ['version' => '3.5.0', 'relative' => true]); HTMLHelper::_('script', 'com_patchtester/patchtester.js', ['version' => 'auto', 'relative' => true]); + +$listOrder = $this->escape($this->state->get('list.ordering')); +$listDirn = $this->escape($this->state->get('list.direction')); ?>
@@ -43,10 +46,10 @@ HTMLHelper::_('script', 'com_patchtester/patchtester.js', ['version' => 'auto', - + - +