Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MINOR move sort column&direction into their own vars, otherwise, canS…

…ortBy(Date DESC) will always return false, since DESC is not part of the column name. (from r96411) (from r98137)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102609 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
commit 10537d5133315c4be036be0da79336503898f7ff 1 parent be4c42f
@chillu chillu authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 forms/TableListField.php
View
7 forms/TableListField.php
@@ -490,12 +490,13 @@ function getQuery() {
}
if(!empty($_REQUEST['ctf'][$this->Name()]['sort'])) {
- $sort = $_REQUEST['ctf'][$this->Name()]['sort'];
+ $column = $_REQUEST['ctf'][$this->Name()]['sort'];
+ $dir = 'ASC';
if(!empty($_REQUEST['ctf'][$this->Name()]['dir'])) {
$dir = $_REQUEST['ctf'][$this->Name()]['dir'];
- if(strtoupper(trim($dir)) == 'DESC') $sort .= ' DESC';
+ if(strtoupper(trim($dir)) == 'DESC') $dir = 'DESC';
}
- if($query->canSortBy($sort)) $query->orderby = $sort;
+ if($query->canSortBy($column)) $query->orderby = $column.' '.$dir;
}
return $query;
Please sign in to comment.
Something went wrong with that request. Please try again.