Code

Reset keys, if empty data is given.
[gosa.git] / gosa-core / include / class_sortableListing.inc
index 55c3bbfe9bc5617b76eabbc41a0c9de330ad8334..26d30870e2edb979bdcc66f531275c669d66150e 100644 (file)
@@ -101,6 +101,7 @@ class sortableListing {
     // Transfer information
     $this->displayData= array();
     $this->modes= array();
+    $this->mapping= array();
     foreach ($data as $key => $value) {
       $this->displayData[]= $value['data'];
       if (isset($value['mode'])) {
@@ -110,7 +111,9 @@ class sortableListing {
     $this->keys= array_keys($data);
 
     // Create initial mapping
-    $this->mapping= range(0, abs(count($this->keys)-1));
+    if(count($this->keys)){
+      $this->mapping= range(0, abs(count($this->keys)-1));
+    }
     $this->current_mapping= $this->mapping;
 
     // Find the number of coluns