Commits

christiansalazar  committed 47063a1

adding EYuiAjaxAction demo

  • Participants
  • Parent commits a07e9fc

Comments (0)

Files changed (4)

File protected/controllers/ExampleController.php

 		$this->render('eyuiform'
 			,array('user'=>$user,'validationModel'=>EyuiFormDb::newModel($user)));
 	}
+	
+	public function actionEYuiAjaxAction() 
+	{ 
+		$this->render('eyuiajaxaction'); 
+	}	
 }

File protected/controllers/SiteController.php

 		Yii::app()->user->logout();
 		$this->redirect(Yii::app()->homeUrl);
 	}
+	
+	public function actionSample(){
+		sleep(3);
+		echo "hello from actionSample!";
+	}
 }

File protected/views/example/eyuiajaxaction.php

+<h1>EYuiAjaxAction</h1>
+<p>This widget invokes an Action via Ajax, please click the link below:</p>
+	<?php 
+		$this->widget('ext.EYui.EYuiAjaxAction'
+			,array(
+				'id'=>'myId',
+				'action'=>array('site/Sample'),
+				'label'=>'Test Me',
+				'labelOn'=>'Sending...',
+				'onBeforeAjaxCall'=>'function(){ $("#mylogger").html("please wait..."); }',
+				'onSuccess'=>'function(data){ $("#mylogger").html(data); }',
+				'onError'=>'function(e){ $("#mylogger").html(e.responseText); }',
+				'htmlOptions'=>array('class'=>'yourclass'),
+			)
+		);
+	?>
+	
+	<div id='mylogger'></div>

File protected/views/site/index.php

 <?php echo CHtml::link("Test EYuiSearch",array('example/eyuisearch'));?>
 <br/>
 <?php echo CHtml::link("Test EYuiForm",array('example/eyuiform'));?>
+<br/>
+<?php echo CHtml::link("Test EYuiAjaxAction",array('example/eyuiajaxaction'));?>