Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fixed can sorting cutted array with CArrayDataProvider #1534

Merged
merged 6 commits into from Oct 5, 2012
View
@@ -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)
@@ -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);
}