Fix sorting in complextablefield

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@48250 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2008-01-18 05:01:35 +00:00
parent 27849e2418
commit 3a0fd261ad
2 changed files with 12 additions and 3 deletions

View File

@ -201,9 +201,14 @@ JS;
$limitClause .= " OFFSET {$SQL_start}";
}
$sourceItems = DataObject::get($this->sourceClass, $this->sourceFilter, $this->sourceSort, $this->sourceJoin, $limitClause);
$sort = $this->sourceSort;
if(isset($_REQUEST['ctf'][$this->Name()]['sort'])) {
$sort = Convert::raw2sql($_REQUEST['ctf'][$this->Name()]['sort']);
}
$this->unpagedSourceItems = DataObject::get($this->sourceClass, $this->sourceFilter, $this->sourceSort, $this->sourceJoin);
$sourceItems = DataObject::get($this->sourceClass, $this->sourceFilter, $sort, $this->sourceJoin, $limitClause);
$this->unpagedSourceItems = DataObject::get($this->sourceClass, $sort, $this->sourceSort, $this->sourceJoin);
$this->totalCount = ($this->unpagedSourceItems) ? $this->unpagedSourceItems->TotalItems() : null;

View File

@ -12,6 +12,10 @@ TableListField.prototype = {
onclick: this.deleteRecord.bind(this)
};
rules['#'+this.id+' th a'] = {
onclick: this.paginate.bind(this)
};
rules['#'+this.id+' th'] = {
initialize: function() {
var sortLinks = $$('span.sortLinkHidden a', this);