Skip to content

Commit

Permalink
Implemented ability to specify "Default" sort direction on a column f…
Browse files Browse the repository at this point in the history
…or QDataGrid and QDataGridColumn
  • Loading branch information
mikeho committed Apr 21, 2012
1 parent c171530 commit 495840b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion includes/qcodo/_core/qform/QDataGridBase.class.php
Expand Up @@ -456,7 +456,7 @@ public function Sort_Click($strFormId, $strControlId, $strParameter) {
} else { } else {
// Nope -- so let's set it to this column // Nope -- so let's set it to this column
$this->intSortColumnIndex = $intColumnIndex; $this->intSortColumnIndex = $intColumnIndex;
$this->intSortDirection = 0; $this->intSortDirection = $objColumn->DefaultSortDirection;
} }
} else { } else {
// It isn't -- clear all sort properties // It isn't -- clear all sort properties
Expand Down
11 changes: 9 additions & 2 deletions includes/qcodo/_core/qform/QDataGridColumn.class.php
Expand Up @@ -37,6 +37,7 @@ class QDataGridColumn extends QBaseClass {
protected $strName; protected $strName;
protected $strHtml; protected $strHtml;
protected $blnHtmlEntities = true; protected $blnHtmlEntities = true;
protected $intDefaultSortDirection = 0;


public function __construct($strName, $strHtml = null, $objOverrideParameters = null) { public function __construct($strName, $strHtml = null, $objOverrideParameters = null) {
$this->strName = $strName; $this->strName = $strName;
Expand Down Expand Up @@ -175,6 +176,7 @@ public function __get($strName) {
// MANUAL QUERY BEHAVIORS // MANUAL QUERY BEHAVIORS
case "SortByCommand": return $this->objOrderByClause; case "SortByCommand": return $this->objOrderByClause;
case "ReverseSortByCommand": return $this->objReverseOrderByClause; case "ReverseSortByCommand": return $this->objReverseOrderByClause;
case "DefaultSortDirection": return $this->intDefaultSortDirection;


// MISC // MISC
case "Html": return $this->strHtml; case "Html": return $this->strHtml;
Expand Down Expand Up @@ -371,8 +373,13 @@ public function __set($strName, $mixValue) {
$objExc->IncrementOffset(); $objExc->IncrementOffset();
throw $objExc; throw $objExc;
} }

case "DefaultSortDirection":

if ($mixValue == 1)
$this->intDefaultSortDirection = 1;
else
$this->intDefaultSortDirection = 0;
break;

// MISC // MISC
case "Html": case "Html":
try { try {
Expand Down

0 comments on commit 495840b

Please sign in to comment.