Skip to content

Commit 7c2ab95

Browse files
committed
Add sortBy
1 parent 73bf62f commit 7c2ab95

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

src/PhpTableGenerator/HeadCell.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,18 @@ class HeadCell extends Cell
6161
/**
6262
* @var
6363
*/
64-
private $sortDir;
64+
private $sortBy;
6565

6666
/**
6767
* @var
6868
*/
6969
private $sortDirKey;
7070

71+
/**
72+
* @var
73+
*/
74+
private $sortDir;
75+
7176
public function __construct($title = null, $alias = null, $content = null, $htmlspecialchars = false)
7277
{
7378
if ($title !== null) {
@@ -217,6 +222,22 @@ public function setSortDir($sortDir)
217222
$this->sortDir = (strtolower($sortDir) === 'asc') ? 'asc' : 'desc';
218223
}
219224

225+
/**
226+
* @return string
227+
*/
228+
public function getSortBy()
229+
{
230+
return $this->sortBy;
231+
}
232+
233+
/**
234+
* @param string $sortBy
235+
*/
236+
public function setSortBy($sortBy)
237+
{
238+
$this->sortBy = $sortBy;
239+
}
240+
220241
/**
221242
* According the current sorting direction, alias, and etc return
222243
* the next sorting direction
@@ -226,7 +247,7 @@ public function setSortDir($sortDir)
226247
public function getNewSortDir()
227248
{
228249
$alias = $this->getAlias();
229-
$sortBy = $this->getSortBy();
250+
//$sortBy = $this->getSortBy();
230251
$sortDir = $this->getSortDir();
231252

232253
return ($alias === $sortBy && $sortDir === 'asc') ? 'desc' : 'asc';

0 commit comments

Comments
 (0)