From f725ab468aeead30fa991910ffd36d555c621593 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Wed, 29 May 2024 09:23:16 +0000 Subject: [PATCH] Fix: Server-side processing with SQL Server would give an error when entering into the neutral sort (i.e. third click of a column header --- Editor.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Editor.php b/Editor.php index a599555..a54085a 100644 --- a/Editor.php +++ b/Editor.php @@ -1669,6 +1669,13 @@ private function _ssp_sort($query, $http) ); } } + + // Paging makes little sense without an ordering clause, so if there is + // no order to apply (possible in DT2 on the third click of a header) + // we apply the primary key as the ordering value. + if (! isset($http['order']) || count($http['order']) === 0) { + $query->order($this->_pkey[0] . ' asc'); + } } private function _constructSearchBuilderConditions($query, $data)