mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR move sort column&direction into their own vars, otherwise, canSortBy(Date DESC) will always return false, since DESC is not part of the column name. (from r96411)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@98137 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
298735506a
commit
962dae2dc7
@ -486,12 +486,13 @@ JS
|
||||
}
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user