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(

	'dataProvider'=>$dataProvider,

	'itemView'=>'_jobview',

)); ?>



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 ?

What i do in your case is to extend CListView but this is because I create my own widgets; there is another option and easier one: why dont you just include a search field before the rendering of the widget?





<h1>Job Postings</h1>


<?php // HERE INCLUDE THE SEARCH FORM?>


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

        'dataProvider'=>$dataProvider,

        'itemView'=>'_jobview',

)); ?>




Then it is just a matter to point the action to the controller/action that renders the list and have the appropriate search function that will filter upon the POST parameters.

Cheers