我是Yii框架的新手。目前我有三个模型测试1,测试2,测试3。我为所有三个模型创建了管理页面。因此,我可以单独查看每个模型的网格视图。现在,我想对所有三个网格视图使用单个页面。即我想在该页面中创建三个选项卡。每个选项卡都应打开相应模型名称的网格视图。我该怎么做。
我通过部分渲染$model和$form我的活动形式传递给每个选项卡,将网格置于"查看/_form_firstPart"和"查看/_form_second">
$this->widget('bootstrap.widgets.TbTabs', array(
'id' => 'tabs',
'type' => 'tabs', // '', 'tabs', 'pills' (or 'list')
'tabs' => array(
array(
'label' => 'someLabel',
'content' => $this->renderPartial('_form_firstPart', array(
'model' => $model,
'form' => $form,
)
,true),
'active' => true,
),
array(
'label' => 'anotherLabel',
'content' => $this->renderPartial('_form_second', array(
'model' => $model,
'form' => $form,
) ,true),
),
)));
如果你不使用bootstrap,那么你可以使用cjuitabs,
$this->widget('zii.widgets.jui.CJuiTabs', array(
'tabs'=>array(
'first model' =>array('content'=>$tab_1),
'second model' =>array('content'=>$tab_2),
),
// additional javascript options for the tabs plugin
'options'=>array(
'collapsible'=>true,
),
));