我希望在保存标题表单后显示标签,请参阅附图,
答案 0 :(得分:0)
您可以在保存方法后添加参数以重定向URL。然后在您的视图中添加代码,如;
$activeTab= null;
if(isset($_GET['tab'])){
$activeTab = $_GET['tab'];
}
并在您的tabs类中控制$ activeTab变量的值
if($activeTab == 'Reflists'){
echo "<li class = "blabla active">Reflist</li>";
}
else {
echo "<li class = "blabla">Reflist</li>";
}
这是标签代码的示例。
答案 1 :(得分:0)
这里有一些工作示例
来自Controller的。
$activeTab = 0;
if(isset($_POST['WorPerformance']))
{
$activeTab = 2; //set the selected tabs here
$worperfm->attributes=$_POST['WorPerformance'];
if($worperfm->save()){
$msg2 = CHtml::link('View Details',array('view','id'=>$worperfm->WOR_ID));
Yii::app()->user->setFlash('success','You data have been saved successfully. '.$msg2);
}
}
$this->render('view',array(
'model'=>$this->loadModel($id),
'endorsp'=>$endorsp, //variable tabs 0
'enddetail'=>$enddetail, //variable tabs 1
'worperfm'=>$worperfm, //variable tabs 2
'activeTab'=>$activeTab,//pass the variable here
));
来自View:
<?php
$this->widget('zii.widgets.jui.CJuiTabs',array(
'tabs'=>array(
'PF Log Details'=>array('id'=>'endetails-id','content'=>$this->renderPartial(
'/enddetail/_formpf',
array('model'=>$model),TRUE
)),
'Endorsement Species'=>array('id'=>'endorsespecies-id','content'=>$this->renderPartial(
'/endorspecies/_formClone2',
array('model'=>$model),TRUE
)),
'Work Performance'=>array('id'=>'worperform-id','content'=>$this->renderPartial(
'/worPerformance/_formpf',array('worPerformance'=>$worperfm
),TRUE)),
),
'options'=>array(
'collapsible'=>true,
'selected'=>$activeTab,//get from controller variable 'activeTab'=>$activeTab
),
'id'=>'MyTab-Menu',
));
?>