Hi Yii!! other question is: the "Project" model [color="#556B2F"]HAS_MANY[/color] "Tags", so i want to insert a related Tags [color="#FF8C00"]GridView [/color] like this "[color="#00BFFF"]admin.php[/color]" in "Tags" view (which work well):
To insert it into [color="#00BFFF"]"_form" [/color]"Project" view, i solved it with:
"Project" [color="#00BFFF"]_form[/color] view:
<?php /** @var BootActiveForm $form */
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
'id'=>'projects-form',
'htmlOptions'=>array('class'=>'well'),
'type'=>'horizontal',
));
?>
<fieldset>
<p>Fields with <span class="required">*</span> are required.</p>
<?php echo $form->errorSummary($model); ?>
<?php echo $form->textFieldRow($model, 'title', array('class'=>'span3')); ?>
<?php echo $form->textAreaRow($model, 'description', array('class'=>'span3', 'rows'=>3)); ?>
<?php
echo $this->renderPartial('_tags_admin', array('model'=>$model));
?>
</fieldset>
<?php $form->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit', 'type'=>'primary', 'label'=>($model->isNewRecord ? 'Create' : 'Save'))); ?>
<?php $this->endWidget(); ?>
the "Project" [color="#00BFFF"]"_tags_admin.php"[/color] view:
<?php
$tags = new Tags;
$this->widget('bootstrap.widgets.TbGridView',array(
'id'=>'tags-grid',
'dataProvider'=>$tags->searchProjectTags($model),
'filter'=>$tags,
'columns'=>array(
'id',
'tag',
'position',
'tag_project',
'status',
'create_time',
array(
'class'=>'bootstrap.widgets.TbButtonColumn',
),
),
));
?>
The "Tags.php" model:
public function searchProjectTags($project)
{
$criteria=new CDbCriteria;
$criteria->compare('tag_project',$project->id);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
It works! the [color="#FF8C00"]GridView[/color] is showed with the correct related tags, but the [color="#800080"]"ButtonColumn"[/color] action is wrong, this seems to be linking to "Project", not to "Tags", i mean, the Tag1 "Update" "ButtonColumn" link to (…&r=project/update&id=1) but this shold be (…&r=tag/update&id=1).
Does any one knows why? And how to solve it?
Thank you!