Prechádzať zdrojové kódy

fixed default order by desc in TableAjax

Piotr Labudda 9 rokov pred
rodič
commit
678c4e2251
1 zmenil súbory, kde vykonal 2 pridanie a 2 odobranie
  1. 2 2
      SE/se-lib/Route/ViewTableAjax.php

+ 2 - 2
SE/se-lib/Route/ViewTableAjax.php

@@ -29,7 +29,6 @@ class Route_ViewTableAjax extends RouteBase {
 		}
 		$tbl->setSyncUrl($syncUrl);
 		$tbl->setLabel($tblLabel);
-		$tbl->setFilterInit($filterInit);
 		$tbl->addRowFunction('edit');
 		$tbl->addRowFunction('hist');
 		$tbl->addRowFunction('files');
@@ -52,7 +51,7 @@ class Route_ViewTableAjax extends RouteBase {
 
 			$forceFilterInit = array();
 			$filterInit = new stdClass();
-			$filterInit->currSortCol = 'ID';
+			$filterInit->currSortCol = $acl->getPrimaryKeyField();
 			$filterInit->currSortFlip = 'desc';
 			foreach ($_GET as $k => $v) {
 				if (strlen($k) > 3 && substr($k, 0, 2) == 'f_' && !empty($v)) {// filter prefix
@@ -68,6 +67,7 @@ class Route_ViewTableAjax extends RouteBase {
 			}
 
 			$tbl = $this->getTableAjaxWidget($acl);
+			$tbl->setFilterInit($filterInit);
 			if (!empty($forceFilterInit)) $tbl->setForceFilterInit($forceFilterInit);
 			echo $tbl->render();