hi guys…
I have another problems…
I want to do search n filter through CGridView…
I refer from this post;
I do exactly like that post, but my problem is when I try to search a data, the search function is not working…
I don’t know where else the error…
<?php
$this->menu=array(
array('label'=>'List Permohonan', 'url'=>array('index')),
array('label'=>'Manage Permohonan', 'url'=>array('admin')),
);
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
$('.search-form').toggle();
return false;
});
$('.search-form form').submit(function(){
$('#permohonan-grid').yiiGridView('update', {
data: $(this).serialize()
});
return false;
});
");
?>
<h1>Senarai Permohonan</h1>
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'permohonan-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
array(
'header'=>'Nama Pegawai',
'value'=>'$data->pegIc->peg_nama'),
array(
'header'=>'Negara yang Dilawati',
'name' => 'neg_id',
'filter'=>CHtml::listData(LNegara::model()->findAll(), 'neg_id', 'neg_lawat'),
'value'=>'LNegara::Model()->FindByPk($data->neg_id)->neg_lawat',
),
array(
'header'=>'Tujuan Lawatan',
'name' => 'tuj_id',
'filter'=>CHtml::listData(LTujuanLawatan::model()->findAll(), 'tuj_id', 'tuj_sbb'),
'value'=>'LTujuanLawatan::Model()->FindByPk($data->tuj_id)->tuj_sbb',
),
array(
'header'=>'Tarikh Mula Lawatan',
'value'=>'$data->moh_cutimula'),
array(
'header'=>'Tarikh Tamat Lawatan',
'value'=>'$data->moh_cutitamat'),
array(
'header'=>'Tarikh Permohonan',
'value'=>'$data->moh_tarikh'),
array(
'header'=>'Status Permohonan',
'name' => 'stat_id',
'filter'=>CHtml::listData(LStatusPermohonan::model()->findAll(), 'stat_id', 'stat_status'),
'value'=>'LStatusPermohonan::Model()->FindByPk($data->stat_id)->stat_status',
),
array(
'class'=>'CButtonColumn',
'template'=>' {update} ',
'buttons'=>array(
'update' => array(
'url'=>'Yii::app()->controller->createUrl("pegawai/borang",(array("idtab"=>0,"peg_ic"=>$data->peg_ic,"moh_id"=>$data->moh_id)))',
),
),
),
array(
'class'=>'CButtonColumn',
'template'=>' {delete} ',
'visible' =>(Yii::app()->user->name=='admin'),
),
),
)); ?>
like I said before, this forum is my last hope…
please help me!