diff --git a/framework/web/CActiveDataProvider.php b/framework/web/CActiveDataProvider.php index 9b163b2a30..87233ea7fe 100644 --- a/framework/web/CActiveDataProvider.php +++ b/framework/web/CActiveDataProvider.php @@ -106,11 +106,12 @@ public function setCriteria($value) /** * Returns the sorting object. + * @param string $className the sorting object class name. Parameter is available since version 1.1.13. * @return CSort the sorting object. If this is false, it means the sorting is disabled. */ - public function getSort() + public function getSort($className='CSort') { - if(($sort=parent::getSort())!==false) + if(($sort=parent::getSort($className))!==false) $sort->modelClass=$this->modelClass; return $sort; } diff --git a/framework/web/CDataProvider.php b/framework/web/CDataProvider.php index baa2b370fc..d71d86b75a 100644 --- a/framework/web/CDataProvider.php +++ b/framework/web/CDataProvider.php @@ -82,7 +82,7 @@ public function getPagination($className='CPagination') * @param mixed $value the pagination to be used by this data provider. This could be a {@link CPagination} object * or an array used to configure the pagination object. If this is false, it means the pagination should be disabled. * - * You can configre this property same way as a component: + * You can configure this property same way as a component: *
 	 * array(
 	 *     'class' => 'MyPagination',
@@ -94,7 +94,14 @@ public function setPagination($value)
 	{
 		if(is_array($value))
 		{
-			$pagination=isset($value['class']) ? $this->getPagination($value['class']) : $this->getPagination();
+			if(isset($value['class']))
+			{
+				$pagination=$this->getPagination($value['class']);
+				unset($value['class']);
+			}
+			else
+				$pagination=$this->getPagination();
+
 			foreach($value as $k=>$v)
 				$pagination->$k=$v;
 		}
@@ -123,7 +130,7 @@ public function getSort($className='CSort')
 	 * @param mixed $value the sorting to be used by this data provider. This could be a {@link CSort} object
 	 * or an array used to configure the sorting object. If this is false, it means the sorting should be disabled.
 	 *
-	 * You can configre this property same way as a component:
+	 * You can configure this property same way as a component:
 	 * 
 	 * array(
 	 *     'class' => 'MySort',
@@ -135,7 +142,14 @@ public function setSort($value)
 	{
 		if(is_array($value))
 		{
-			$sort=isset($value['class']) ? $this->getSort($value['class']) : $this->getSort();
+			if(isset($value['class']))
+			{
+				$sort=$this->getSort($value['class']);
+				unset($value['class']);
+			}
+			else
+				$sort=$this->getSort();
+
 			foreach($value as $k=>$v)
 				$sort->$k=$v;
 		}