Display Clist View

hey guys I have problem.I need to display the clistview for following details.

this is my controller


	

	public function actionIndex() {


		

		$gsmodel=new UserGradesSpecialty('search');

		$userprofdetail=new UserProfDetails('search');

	

		$crumbs = array (

				array (

						'name' => "Home",

						'url' => array (

								'site/index'

						)

				),

				array (

						'name' => 'FindLocum'

				)

		);

		$title = "Find Locum";

		$criteria = new CDbCriteria ();

		

		if (isset ( $_POST ['UserGradesSpecialty'], $_POST['UserProfDetails'] ) ) {

			if ($_POST ['UserGradesSpecialty'] ['specialty_id'] != "-1") {

				$gsmodel->specialty_id = $_POST ['UserGradesSpecialty'] ['specialty_id'];

			}

			if ($_POST ['UserProfDetails'] ['pref_location_id'] != "-1") {

				$userprofdetail->pref_location_id = $_POST ['UserProfDetails'] ['pref_location_id'];

			}

			if ($_POST ['UserGradesSpecialty'] ['grade_id'] != "-1") {

				$gsmodel->grade_id = $_POST ['UserGradesSpecialty'] ['grade_id'];

			}

			

		}

	

		$users = Yii::app()->db->createCommand()

		->select('u.first_name,u.last_name,r.name,s.specialty,l.name as location')

		->from('users u')

		->join('user_prof_details p', 'u.id = p.users_id')

		->join('user_grades_specialty g', 'u.id = g.users_id')

		->join('speciality s','s.id=g.specialty_id')

		->join('grades r','r.id=g.grade_id')

		->join('locations l','l.id=p.pref_location_id')

		->join('assignments a', 'u.id = a.userid')

		->where('a.itemname=:nid AND

				 u.status=:id AND 

				 p.pref_location_id=:pid AND 

				 g.grade_id=:gid AND

				 g.specialty_id=:sid',

		 array(':nid'=>'member', ':id'=>5 ,':pid'=>$userprofdetail->pref_location_id,':gid'=>$gsmodel->grade_id,':sid'=>$gsmodel->specialty_id) )

		->queryAll();

		$users->reset();

		

		

		

		$dataProvider=new CArrayDataProvider($users,

		array('keyField' =>FALSE )

		

		);

then I need to when click search all i need to display all the data in clistview. pls help me;

can anyone give me the idea for that.

There is an easy way. You can use CActiveRecord as your model class and make your dataProvider from that class. and the pass it to the view file which contain the CListView.

Search some about rendering CListView.

thanx your reply;can u give me sample code for that.pls

actually i nedd both of them are correctly run I mean when click any of the item in dropdown list it should search any hesitatance.

Actually i need to do something like this.how do i do it in correct way


$criteria = new CDbCriteria ();

		

		if (isset ( $_POST ['UserGradesSpecialty'], $_POST['UserProfDetails'] ) ) {

			if ($_POST ['UserGradesSpecialty'] ['specialty_id'] != "-1") {

				$gsmodel->specialty_id = $_POST ['UserGradesSpecialty'] ['specialty_id'];

			}

			if ($_POST ['UserProfDetails'] ['pref_location_id'] != "-1") {

				$userprofdetail->pref_location_id = $_POST ['UserProfDetails'] ['pref_location_id'];

			}

			if ($_POST ['UserGradesSpecialty'] ['grade_id'] != "-1") {

				$gsmodel->grade_id = $_POST ['UserGradesSpecialty'] ['grade_id'];

			}

			

		}

	

		$users = Yii::app()->db->createCommand()

		->select('u.first_name,u.last_name,r.name,s.specialty,l.name as location')

		->from('users u')

		->join('user_prof_details p', 'u.id = p.users_id')

		->join('user_grades_specialty g', 'u.id = g.users_id')

		->join('speciality s','s.id=g.specialty_id')

		->join('grades r','r.id=g.grade_id')

		->join('locations l','l.id=p.pref_location_id')

		->join('assignments a', 'u.id = a.userid')

		->where('a.itemname=:nid AND

				 u.status=:id AND 

				 p.pref_location_id=:pid

				if(":pid" IS -1){

				":pid"=$userprofdetail->search();

				}

				AND 

				 g.grade_id=:gid

				if(":gid" IS -1){

				":gid"=$gsmodel->search();

				}

				AND

				 g.specialty_id=:sid

				if(":sid" IS -1)

				":sid"=$gsmodel->search();

				'

				,

		 array(  ':nid'=>'member',

		 		 ':id'=>5 ,

		 		 ':pid'=>$userprofdetail->pref_location_id,

		 		 ':gid'=>$gsmodel->grade_id,

		 		 ':sid'=>$gsmodel->specialty_id) 

		)

		->queryAll();

		$users=$gsmodel->search();

		$users=$userprofdetail->search();

		

		

		

		$dataProvider=new CArrayDataProvider($users,

		array('keyField' =>FALSE )

		

		);

		

Why don’t you use Gii tools. it generate all you need in a second.