我正在使用以下YII小部件代码
$this->widget('zii.widgets.jui.CJuiAccordion',array(
'panels'=>array(
'panel 1'=>'content for panel 1',
'panel 2'=>'content for panel 2',
// panel 3 contains the content rendered by a partial view
//'panel 3'=>$this->renderPartial('_partial',null,true),
),
// additional javascript options for the accordion plugin
'options'=>array(
'animated'=>'bounceslide',
),
));
我想点击面板2并在页面加载时显示数据,我该怎么办?
答案 0 :(得分:3)
您可以通过选项active
参数传递已打开面板的从零开始的索引,如下所述:http://api.jqueryui.com/accordion/#option-active。在您的情况下,代码将是:
$this->widget('zii.widgets.jui.CJuiAccordion',array(
'panels' => array(
'panel 1' => 'content for panel 1',
'panel 2' => 'content for panel 2',
// panel 3 contains the content rendered by a partial view
//'panel 3' => $this->renderPartial('_partial',null,true),
),
// additional javascript options for the accordion plugin
'options' => array(
'animated' => 'bounceslide',
'active' => 1,
),
));