From adee6b0e4a8cdafd58a8ee454a11944fefe91db3 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Thu, 2 Oct 2008 08:53:44 +0000 Subject: [PATCH] Fixed sorting in TableListField and subclasses git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.2@63524 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/TableListField.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/forms/TableListField.php b/forms/TableListField.php index cbcd69a6d..ef1ee127f 100755 --- a/forms/TableListField.php +++ b/forms/TableListField.php @@ -242,7 +242,7 @@ JS "Name" => $fieldName, "Title" => $fieldTitle, "IsSortable" => $isSortable, - "SortLink" => Convert::raw2xml($sortLink), + "SortLink" => $sortLink, "SortBy" => $isSorted, "SortDirection" => (isset($_REQUEST['ctf'][$this->Name()]['dir'])) ? $_REQUEST['ctf'][$this->Name()]['dir'] : null )); @@ -921,7 +921,14 @@ JS } function BaseLink() { - return $this->FormAction() . "&action_callfieldmethod&fieldName={$this->Name()}&ctf[ID]={$this->sourceID()}&methodName=ajax_refresh&SecurityID=" . Session::get('SecurityID'); + $link = $this->FormAction() . "&action_callfieldmethod&fieldName={$this->Name()}&ctf[ID]={$this->sourceID()}&methodName=ajax_refresh&SecurityID=" . Session::get('SecurityID'); + if(isset($_REQUEST['ctf'][$this->Name()]['sort'])) { + $link = HTTP::setGetVar("ctf[{$this->Name()}][sort]", $_REQUEST['ctf'][$this->Name()]['sort']); + } + if(isset($_REQUEST['ctf'][$this->Name()]['dir'])) { + $link = HTTP::setGetVar("ctf[{$this->Name()}][dir]", $_REQUEST['ctf'][$this->Name()]['dir']); + } + return str_replace('&','&',$link); } /**