Browse files

Merge pull request #1534 from Yiivgeny/CArrayDataProvider-bug

Fixed can sorting cutted array with CArrayDataProvider
  • Loading branch information...
2 parents 17069e3 + 0fe0be8 commit a7938804cb91fe2d46d58a81f96cd05371d760b5 @samdark samdark committed Oct 5, 2012
Showing with 11 additions and 2 deletions.
  1. +1 −0 CHANGELOG
  2. +10 −2 framework/web/CArrayDataProvider.php
View
1 CHANGELOG
@@ -49,6 +49,7 @@ Version 1.1.13 work in progress
- Enh #1426: Behaviors are now affecting memory consumption significantly less (slavcodev, creocoder, Qiang, samdark)
- Enh #1443: Added CHttpRequest::getRawBody() that allows reading RAW HTTP request body multiple times (itamar82, resurtm, samdark)
- Enh #1518: Allow to configure CHtml::$closeSingleTags and CHtml::$renderSpecialAttributesValue. Useful for HTML5 code (creocoder)
+- Enh #1531: CArrayDataProvider is now able to sort cutted array, where sorting column is not available in every entry (Yiivgeny)
- Enh: Fixed the check for ajaxUpdate false value in jquery.yiilistview.js as that never happens (mdomba)
- Enh: Requirements checker: added check for Oracle database (pdo_oci extension) and MSSQL (pdo_dblib, pdo_sqlsrv and pdo_mssql extensions) (resurtm)
- Enh: Added CChainedLogFilter class to allow adding multiple filters to a logroute (cebe)
View
12 framework/web/CArrayDataProvider.php
@@ -156,8 +156,16 @@ protected function sortData($directions)
*/
protected function getSortingFieldValue($data, $fields)
{
- foreach ($fields as $field)
- $data = is_object($data) ? $data->$field : $data[$field];
+ if(is_object($data))
+ {
+ foreach($fields as $field)
+ $data=isset($data->$field) ? $data->$field : null;
+ }
+ else
+ {
+ foreach($fields as $field)
+ $data=isset($data[$field]) ? $data[$field] : null;
+ }
return $this->caseSensitiveSort ? $data : mb_strtolower($data,Yii::app()->charset);
}

0 comments on commit a793880

Please sign in to comment.