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

@ -200,10 +200,15 @@ JS;
$SQL_start = intval($_REQUEST['ctf'][$this->Name()]['start']);
$limitClause .= " OFFSET {$SQL_start}";
}
$sort = $this->sourceSort;
if(isset($_REQUEST['ctf'][$this->Name()]['sort'])) {
$sort = Convert::raw2sql($_REQUEST['ctf'][$this->Name()]['sort']);
}
$sourceItems = DataObject::get($this->sourceClass, $this->sourceFilter, $this->sourceSort, $this->sourceJoin, $limitClause);
$sourceItems = DataObject::get($this->sourceClass, $this->sourceFilter, $sort, $this->sourceJoin, $limitClause);
$this->unpagedSourceItems = DataObject::get($this->sourceClass, $this->sourceFilter, $this->sourceSort, $this->sourceJoin);
$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);
@ -269,4 +273,4 @@ TableListRecord.prototype = {
}
//TableListRecord.applyTo('div.TableListField tr');
TableListField.applyTo('div.TableListField');
TableListField.applyTo('div.TableListField');