Hi,
I have placed my code below.Please go through and help me where i need modification.
I am trying to implement Search functioanlity.
Initially,i need to pass user value(from a textbox) to database.
and i need to display the result set in Gridview based on search query.
The below code will display grid view and column based search is done.
My view(index.php):
<?php
/* @var $this SearchPermDataController */
$this->breadcrumbs=array(
'Search Perm Data',
);
?><!-- search-form -->
<?php
$dataProvider=$model->search();
$this->widget(‘zii.widgets.grid.CGridView’, array(
'id' => 'my-model-grid',
'dataProvider' => $dataProvider,
'filter' => $model,
'columns' => array(
'CASE_NO',
'EMPLOYER_NAME',
),
));
?>
My controller (SearchPermDataController):
public function actionIndex()
{$model = new SearchPermData('search');
$model->unsetAttributes(); // clear any default values
if (isset($_GET['SearchPermData'])) {
$model->attributes = $_GET['SearchPermData'];
}
$this->render('index', array(
'model' => $model,
));
}
Model (SearchPermData):
public function search()
{
$criteria=new CDbCriteria;
$criteria->compare('CASE_NO',$this->CASE_NO,true);
return new CActiveDataProvider(($this), array(
'criteria' => $criteria,
));
}
Please help me in doing this…