Yii Framework Forum: Tidak Dapat Menampilkan Form Di Eupdatedialog - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Tidak Dapat Menampilkan Form Di Eupdatedialog Rate Topic: -----

#1 User is offline   C.S.Putera 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 92
  • Joined: 18-May 11

Posted 07 October 2012 - 08:12 AM

Halo yii-ers semua. Mohon bantuan agan - agan sekalian, ane ada kesulitan untuk update cgridview pake EUpdateDialog, yang ane lakukan adalah sbb :

1. Ane taro extensionnya di protected/extensions/
2. Di view ane :


<?php $this->widget( 'ext.EUpdateDialog.EUpdateDialog' ); ?>

<?php

$this->widget('zii.widgets.grid.CGridView', array(
	/*
         *
        */
array(
	'class'=>'CButtonColumn',
        'buttons' => array(
        'receiving'=>array(
		'label' => 'Receiving',
	        'url'=>'Yii::app()->createUrl("admin/producthistory/add",
                                            array(
						"pid" => $data->product_id,
					        "poid_1" => $data->product_option_id_1,
					        "povid_1" => $data->product_option_value_id_1,
					        "poid_2" => $data->product_option_id_2,
						"povid_2" => $data->product_option_value_id_2,
						"poid_3" => $data->product_option_id_3,
						"povid_3" => $data->product_option_value_id_3
		))',
		'imageUrl' => Yii::app()->baseUrl.'/images/receiving.png',
		'click' => 'updateDialogOpen',
		'options' => array(
			'data-update-dialog-title' => Yii::t( 'app', 'Receiving' ),
		)
	),
)
/***/
)))); 
?>

<?php
echo CHtml::link( 'Add', array( 'productHistory/add',
			'pid'=>1,'poid_1'=>1,'povid_1'=>1,'poid_2'=>1,'povid_2'=>1,'poid_3'=>1,'povid_3'=>1),
			array(
				'class' => 'update-dialog-open-link',
				'data-update-dialog-title' => Yii::t( 'app', 'New Product' )
));
?>



4. Di ProductHistoryController :


class ProductHistoryController extends AdministratorController
{
	private $_model;

        public function actionAdd($pid, $poid_1, $povid_1, $poid_2, $povid_2, $poid_3, $povid_3)
	{
		$model = new ProductHistory('add');
                
		if(isset($_POST['ProductHistory']))
		{
			$model->attributes = $_POST['ProductHistory'];
                        
                        if($model->save())
			{
				if (Yii::app()->request->isAjaxRequest)
                                {
                		Yii::app()->clientScript->scriptMap['jquery.js'] = false;
                                Yii::app()->clientScript->scriptMap['jquery.min.js'] = false;
			        Yii::app()->clientScript->scriptMap['jquery-ui.min.js'] = false;
                       	
                       	        echo CJSON::encode(array(
                                    'status'=>'success',
                                    'content'=>"Product History successfully created"
                       	        ));
                       	        exit;
                                }
		                else
		                {
            	             Yii::app()->user->setFlash('formsuccess', 'Product History has been successfully added.');
		                }
                        }
		}
		
		if( Yii::app()->request->isAjaxRequest )
		{
			// Stop jQuery from re-initialization
			Yii::app()->clientScript->scriptMap['jquery.js'] = false;
			Yii::app()->clientScript->scriptMap['jquery.min.js'] = false;
			Yii::app()->clientScript->scriptMap['jquery-ui.min.js'] = false;
			echo CJSON::encode( array(
					'status' => 'render',
					'content' => $this->renderPartial('form', compact('model'), true, true ));
			exit;
		}
		else
			$this->render('form', compact('model'));
	}

        public function loadModel($id)
	{
		  if( $this->_model === null )
		  {
		    if( isset( $_GET['id'] ) )
		      $this->_model = ProductHistory::model()->findByPk( (int)$_GET['id'] );
		    if( $this->_model === null )
		      throw new CHttpException( 404, 'The requested page does not exist.' );
		  }
		  return $this->_model;
	}



Waktu ane cek di firebug, formnya sudah muncul di response dan html, tapi kaga keupdate di dialognya. Di dialognya terus tampil tulisan "Loading...". Terus di bagian akhirnya ada notif seperti ni :

{"status":"render","content":null,"0":true,"1":true}


Ada yang pernah pakai dialog dengan cgridview ? Mohon bantuannya ;D
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users