From: cajus Date: Tue, 19 Jan 2010 11:24:25 +0000 (+0000) Subject: Added permanent scroll position saver to sortable lists X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2c35fedaee93bf7fc8d2171a78efed2b6521db08;p=gosa.git Added permanent scroll position saver to sortable lists git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15195 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_sortableListing.inc b/gosa-core/include/class_sortableListing.inc index 0e346f8ad..8ebd88c4b 100644 --- a/gosa-core/include/class_sortableListing.inc +++ b/gosa-core/include/class_sortableListing.inc @@ -40,6 +40,7 @@ class sortableListing { private $mapping; private $current_mapping; private $active_index; + private $scrollPosition= 0; private $acl= ""; private $modified= false; @@ -218,9 +219,7 @@ class sortableListing { $result.= ' }'; $result.= 'Position.includeScrollOffsets = true;'; $result.= ' Sortable.create(\''.$this->id.'\',{tag:\'tr\', ghosting:false, constraint:\'vertical\', scroll:\'scroll_'.$this->id.'\',onUpdate : updateOrder});'; - if (isset($_POST['position_'.$this->id]) && is_numeric($_POST['position_'.$this->id])) { - $result.= '$("scroll_'.$this->id.'").scrollTop= '.$_POST['position_'.$this->id].';'; - } + $result.= '$("scroll_'.$this->id.'").scrollTop= '.$this->scrollPosition.';'; $result.= 'var box = $("scroll_'.$this->id.'").onscroll= function() {$("position_'.$this->id.'").value= this.scrollTop;}'; $result.= ''; @@ -233,6 +232,10 @@ class sortableListing { // Do not do anything if we're not posted - or have no permission if (strpos($this->acl, 'w') !== false && isset($_POST['reorder_'.$this->id])){ + if (isset($_POST['position_'.$this->id]) && is_numeric($_POST['position_'.$this->id])) { + $this->scrollPosition= $_POST['position_'.$this->id]; + } + // Move requested? $move= $_POST['reorder_'.$this->id]; if ($move != "") {