Hi,
I am trying to get the property from CActiveDataProvider to textfield.
Here is my model:
public function findMitraFromMitraLokasi($mitra_id){
$criteria = new CDbCriteria;
$criteria->select ='t.id,
t.no_anggota,
t.unit_id,
t.nama_depan AS nama_depan,
t.nama_belakang AS nama_belakang,
t.no_identitas,
t.no_telepon_rumah,
t.no_hp,
t.no_hp1,
t.email,
t.tgl_bergabung';
$criteria->condition = 't.id <> :id';
$criteria->params = array(':id' => $mitra_id);
$criteria->order = 't.no_anggota ASC';
return new CActiveDataProvider('Mitra', array('criteria' => $criteria));
}
Here is my controller:
public function actionAdmin($mitra_id)
{
if(isset($mitra) && !empty($mitra)){
$model = Mitra::model()->findMitraFromMitraLokasi($mitra_id);
$tipe = true;
}
$this->render('admin1', array(
'model' => $model,
));
}
Here is my views:
1. admin1 view:
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search', array(
'model' => $model,
)); ?>
</div>
<?php
$this->widget('zii.widgets.grid.CGridView', array(
'id' => 'mitra-grid',
'dataProvider' => $model,
'columns' => array(
'no_anggota',
'nama_depan',
'nama_belakang',
'email',
'no_hp'),
),
);
?>
</div>
2. _search view:
<div class="search-form" style="display:none">
<div class="wide form">
<?php
$form = $this->beginWidget('CActiveForm', array(
'action' => Yii::app()->createUrl($this->route),
'method' => 'get',
));
?>
<fieldset>
<div class="controls">
<?php echo $form->textField($model, 'nama_depan',
array('size' => 50, 'maxlength' => 50)); ?>
</div>
<?php $this->endWidget(); ?>
</div>
</div>
I got the following error (also attached):
Property "CActiveDataProvider.nama_depan" is not defined.
I confused with the above error because when I remark the search, the gridview is displaying the data.
Is there something missing? Please do help this noob
Thanks in advance…