search function

how to approach this?,

I have a view file which currently displays all the available jobs from another model

<h1>Job Postings</h1>

<?php $this->widget('zii.widgets.CListView', array(



)); ?>

now,what i want to happen is, to have a search form at the top of that CListView,

then once a keyword is entered at the form and got submitted, It’ll display only

the jobs that has the particular keyword and is sorted in descending order

how’s that ?, is there an existing built-in function for this ?


Take a look at the gii generated admin. On the top CGridView there is a form as you wish.

For the order, just set default order for CSort.

how to update the default display of CListView of the page once the keyword get’s submitted ?,

because the admin code that I saw from the admin.php view file of any CRUD that i have has these snippets

Yii::app()->clientScript->registerScript('search', "



	return false;


$('.search-form form').submit(function(){

	$.fn.yiiGridView.update('wsrecruitcvhead-grid', {

		data: $(this).serialize()


	return false;




and these

<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>

<div class="search-form" style="display:none">

<?php $this->renderPartial('_search',array(


)); ?>

</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(