1. Christian Salazar
  2. EYuiDemo

Commits

christiansalazar  committed c47b739

using widget EYuiSearch to find demo users

  • Participants
  • Parent commits 774cf8a
  • Branches master

Comments (0)

Files changed (2)

File protected/models/TblUser.php

View file
  * @property string $email
  */
 class TblUser extends CActiveRecord
+	implements EYuiSearchable
 {
+	public function eyuisearchable_findModels($text){
+		$criteria=new CDbCriteria;
+		$criteria->params = array(':text'=>"%".$text."%");
+		$criteria->addCondition("username like :text");
+		return $this->findAll($criteria);
+	}
+
+	public function getUserDescription(){
+		return $this->username." ".$this->email;
+	}
+	
 	/**
 	 * Returns the static model of the specified AR class.
 	 * @param string $className active record class name.
 			'username' => 'Username',
 			'password' => 'Password',
 			'email' => 'Email',
+			'userDescription'=>'User Description',
 		);
 	}
 

File protected/views/example/create.php

View file
 		<?php echo $form->textField($model,'userid'); ?>
 		<?php echo $form->error($model,'userid'); ?>
 	</div>
+	
+	<p style='color: blue'><b>Readme:</b>In this demo, available usernames are:
+		test1, test2...test10
+		<br/>
+		try finding 'test' in textbox below:
+	</p>
+	<div style='width: 400px;'>
+	<?php 
+		$this->widget('ext.EYui.EYuiSearch'
+			,array(
+				'model'=>$model,
+				'attribute'=>'userid',
+				'searchModel'=>TblUser::model(),
+				'attributes'=>array('id','userDescription'),
+			)
+		);
+	?>
+	</div>
 
 	<div class="row">
 		<?php echo $form->labelEx($model,'message'); ?>