@@ -3059,6 +3059,8 @@ public function getTreeModelSorted()
30593059 $ models = array ();
30603060 $ levels = array ();
30613061
3062+
3063+
30623064 // Calculate depth for each model.
30633065 /** @var e_admin_model $model */
30643066 foreach ($ tree ->getTree () as $ id => $ model )
@@ -4287,20 +4289,25 @@ protected function _modifyListQry($raw = false, $isfilter = false, $forceFrom =
42874289 {
42884290 $ qry = $ this ->parseCustomListQry ($ listQry );
42894291 }
4290- elseif ($ this ->sortField && $ this ->sortParent && ! deftrue ( ' e_DEBUG_TREESORT ' ) ) // automated 'tree' sorting.
4292+ /* elseif($this->sortField && $this->sortParent) // automated 'tree' sorting.
42914293 {
4292- // $qry = "SELECT SQL_CALC_FOUND_ROWS a. *, CASE WHEN a.".$this->sortParent." = 0 THEN a.".$this->sortField." ELSE b.".$this->sortField." + (( a.".$this->sortField.")/1000) END AS treesort FROM `#".$this->table."` AS a LEFT JOIN `#".$this->table."` AS b ON a.".$this->sortParent." = b.".$this->pid;
4293- $ qry = $ this ->getParentChildQry ();
4294- $ this ->listOrder = '_treesort ' ; // .$this->sortField;
4294+ // $qry = $this->getParentChildQry();
4295+ // $this->listOrder = '_treesort '; // .$this->sortField;
42954296 // $this->orderStep = ($this->orderStep === 1) ? 100 : $this->orderStep;
4296- }
4297+ }*/
42974298 else
42984299 {
42994300 $ qry = "SELECT SQL_CALC_FOUND_ROWS " .$ tableSFields ." FROM " .$ tableFrom ;
43004301 }
43014302
43024303 }
43034304
4305+ if (empty ($ this ->listOrder ) && $ this ->sortField && $ this ->sortParent )
4306+ {
4307+ $ this ->listOrder = $ this ->sortField ;
4308+ }
4309+
4310+
43044311 // group field - currently auto-added only if there are joins
43054312 // TODO - groupField property
43064313 $ groupField = '' ;
@@ -6600,12 +6607,15 @@ public function getList($ajax = false, $view='default')
66006607 $ request = $ controller ->getRequest ();
66016608 $ id = $ this ->getElementId ();
66026609 $ tree = $ options = array ();
6603- $ tree [$ id ] = $ controller ->getTreeModel ();
6604-
66056610
6606- if (deftrue ('e_DEBUG_TREESORT ' ) && $ view === 'default ' )
6611+ if ($ view === 'default ' && $ controller ->getSortParent () && $ controller ->getSortField ()) // parent / child sorted tree.
6612+ {
6613+ e107 ::getDebug ()->log ("getTreeModelSorted " );
6614+ $ tree [$ id ] = $ controller ->getTreeModelSorted ();
6615+ }
6616+ else
66076617 {
6608- $ controller ->getTreeModelSorted ();
6618+ $ tree [ $ id ] = $ controller ->getTreeModel ();
66096619 }
66106620
66116621 // if going through confirm screen - no JS confirm
0 commit comments