i have a View that combines many models and I make a tab that each contains different models
this is my script at the view
<?php
$this->widget(
'booster.widgets.TbTabs',
array(
'type' => 'tabs',
'tabs' => array(
array(
'label'=>'Genset',
'content'=>$this->renderPartial('/ats/genset', array('model'=>new genset), true ),
'active'=> false
),
array(
'label'=>'ATS',
'content'=>$this->renderPartial('/ats/ats', array('model'=>new ats), true ),
'active'=> false
),
array(
'label'=>'UPS',
'content'=>$this->renderPartial('/ats/ups', array('model'=>new ups), true ),
'active'=> false
),
array(
'label'=>'PLN',
'content'=>$this->renderPartial('/ats/pln', array('model'=>new pln), true ),
'active'=> false
),
),
)
)
?>
at the final tab, which the label name is PLN doesn't work and return error like this
CException Property "pln.merk" is not defined.
where there are something odd, pln is my model, and merk is not one of the columns from pln but from another model which is ats, i made this view file based on ats which has merk column, but this doesn't make sense when all of the view i do renderPartial like Genset, UPS, ATS works fine
only pln, and several other models throws an error message, like somehow they don't recognize the pln's model column but instead read the wrong column from ats model
Edit:
Basically the view is generated by CRUD, and this is the admin.php file where it contains CGridView
<?php
/* @var $this PlnController */
/* @var $model pln */
$this->breadcrumbs=array(
'Plns'=>array('index'),
'Manage',
);
$this->menu=array(
array('label'=>'List pln', 'url'=>array('index')),
array('label'=>'Create pln', 'url'=>array('create')),
);
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
$('.search-form').toggle();
return false;
});
$('.search-form form').submit(function(){
$('#pln-grid').yiiGridView('update', {
data: $(this).serialize()
});
return false;
});
");
?>
<h1>Manage Plns</h1>
<p>
You may optionally enter a comparison operator (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>
<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
'model'=>$model,
)); ?>
</div><!-- search-form -->
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'pln-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'id',
'siteid',
'capacity',
'arus_r',
'arus_s',
'arus_t',
/*
'id_pelanggan',
'jumlah_fasa',
*/
array(
'class'=>'CButtonColumn',
),
),
)); ?>
ATS.php
<?php
/* @var $this AtsController */
/* @var $model ats */
$this->breadcrumbs=array(
'Ats'=>array('index'),
'Manage',
);
$this->menu=array(
array('label'=>'List ats', 'url'=>array('index')),
array('label'=>'Create ats', 'url'=>array('create')),
);
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
$('.search-form').toggle();
return false;
});
$('.search-form form').submit(function(){
$('#ats-grid').yiiGridView('update', {
data: $(this).serialize()
});
return false;
});
");
?>
<h1>Dapot</h1>
<p>
You may optionally enter a comparison operator (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>
<?php
$this->widget(
'booster.widgets.TbTabs',
array(
'type' => 'tabs',
'tabs' => array(
array(
'label'=>'Genset',
'content'=>$this->renderPartial('/ats/genset', array('model'=>new genset), true ),
'active'=> false
),
array(
'label'=>'ATS',
'content'=>$this->renderPartial('/ats/ats', array('model'=>new ats), true ),
'active'=> false
),
array(
'label'=>'UPS',
'content'=>$this->renderPartial('/ats/ups', array('model'=>new ups), true ),
'active'=> false
),
array(
'label'=>'Rectifier',
'content'=>$this->renderPartial('/ats/rectifier', array('model'=>new rectifier), true ),
'active'=> false
),
array(
'label'=>'Baterai',
'content'=>$this->renderPartial('/ats/baterai', array('model'=>new baterai), true ),
'active'=> false
),
array(
'label'=>'BBS',
'content'=>$this->renderPartial('/ats/bbs', array('model'=>new bbs), true ),
'active'=> false
),
array(
'label'=>'Inverter',
'content'=>$this->renderPartial('/ats/inverter', array('model'=>new inverter), true ),
'active'=> false
),
array(
'label'=>'Trafo',
'content'=>$this->renderPartial('/ats/trafo', array('model'=>new trafo), true ),
'active'=> false
),
/*array(
'label'=>'PLN',
'content'=>$this->renderPartial('/ats/pln', array('model'=>new PLN), true ),
'active'=> false
),*/
),
)
)
?>