예제 #1
0
 public function setAttributesByPost($postData = array())
 {
     $postData = Yii::app()->getRequest()->getPost($this->_getPostKey());
     if ($postData) {
         $this->items->clear();
         foreach ($postData as $n => $data) {
             $item = $this->createItem();
             $item->setAttributes(DataHelper::trimRecursive($data));
             // Важно сохранить номер, чтобы правильно сработала ajax валидация
             $this->items[$n] = $item;
         }
     }
 }
예제 #2
0
 public function setAttributesByPost($postData = array())
 {
     $postKey = CHtml::modelName($this);
     $postData = $postData ?: $_POST;
     $data = array();
     if (!empty($postData[$postKey])) {
         $data = $postData[$postKey];
     }
     $this->setAttributes(DataHelper::trimRecursive($data));
 }