From 108a375e839bb3273d451c720b93d3617141af90 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 7 Apr 2010 11:52:08 +0000 Subject: [PATCH] Updated trustModes git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17513 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_sortableListing.inc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/gosa-core/include/class_sortableListing.inc b/gosa-core/include/class_sortableListing.inc index 64e122671..75de2bee5 100644 --- a/gosa-core/include/class_sortableListing.inc +++ b/gosa-core/include/class_sortableListing.inc @@ -478,6 +478,8 @@ class sortableListing { public function sortData() { + if(!count($this->data)) return; + // Extract data $tmp= array(); foreach($this->displayData as $item) { @@ -533,6 +535,23 @@ class sortableListing { $this->mapping[]= count($this->mapping); $this->modified= true; + // Find the number of coluns + reset($this->displayData); + $first= current($this->displayData); + if (is_array($first)) { + $this->columns= count($first); + } else { + $this->columns= 1; + } + + // Preset sort orders to 'down' + for ($column= 0; $column<$this->columns; $column++) { + if(!isset($this->sortDirection[$column])){ + $this->sortDirection[$column]= true; + } + } + + // Sort data after we've added stuff $this->sortData(); } -- 2.30.2