Dropdown In Search Yii. . .

i have a problem,

can anyone help me??

i want to add a dropdown list in _search file, but unsucces. .

this is my code :




<?php echo $data = CHtml::listData( TJurnal::model()->findAll(),'no_akun','keterangan' ); ?>

	<div class="row">

		<?php echo $form->label($model,'no_akun'); ?>>

		<?php echo $form->dropDownList($model,'no_akun', $data);?>

	</div>



No need to do changes in _search() file …you can change in the admin file …the code is:

array(

	    'name'=&gt;'state_id',


	    'value'=&gt;'State::item(&#036;data-&gt;state_id)',


    	    'filter'=&gt;  State::items(),


	),

thanks to sukunj,

but,

i want to add in the top of CGridView, like this :

3737

search.png

so, i think i must add the code on _search. .

can you help me please. . .

thanks before. .

The _search.php will get the dropdown under the "Advanced Search" section. The code you have posted in your first post should work there. Then, you could:

  1. Remove the display:none property on the advanced search container (on admin.php)

  2. Edit the _search.php to show only your Dropdown (remove everything else).

That should make it achieve your desired result.

B

U CAN INCLUDE FOLLOWING CODE IN THE ADMIN.PHP FILE

$dataProvider = $model->search();

$pageSize = Yii::app()->user->getState("pageSize",@$_GET["pageSize"]);

$dataProvider->getPagination()->setPageSize($pageSize);

AND

‘dataProvider’=>$dataProvider,

AND

‘pager’=>array(

	'class'=&gt;'AjaxList',


	//'maxButtonCount'=&gt;25,


	'maxButtonCount'=&gt;&#036;model-&gt;count(),


	'header'=&gt;''