With the following code
view.php
$contentTab = array();
foreach ($grupos as $grupo) {
$contentTab[$grupo->descripcion] = array(
'id'=>$grupo->id,
'content'=>$this->renderPartial('_grupoTab', array('idcontacto'=>$model->id, 'idgrupo'=>$grupo->id), true, true),
);
}
$tabs = $this->widget('zii.widgets.jui.CJuiTabs',
array(
'tabs'=>$contentTab,
'options'=>array(
'collapsible'=>false,
),
)
);
_grupoTab.php
$criteria = new CDbCriteria();
$criteria->compare('idgrupo', $idgrupo);
$criteria->order = 'orden';
$propiedadesporGrupo = Propiedad::model()->findAll($criteria);
$contentAccordion = array();
foreach ($propiedadesporGrupo as $propiedad){
$contentAccordion[$propiedad->descripcion] = $this->renderPartial('_grupoAccordion', array('idcontacto'=>$idcontacto, 'idgrupo'=>$idgrupo, 'idpropiedad'=>$propiedad->id), true, true);
}
$this->widget('zii.widgets.jui.CJuiAccordion',
array(
'panels'=>$contentAccordion,
'options'=>array(
'animated'=>'bounceslide',
'heightStyle'=>'fill',
'activate'=>'js:function(event, ui){
console.log("activate::id: "+ui.newPanel.attr("id"));
}',
)
)
);
_grupoAccordion.php
<?php
// a CGridView and CActiveForm
?>
This will generate three tabs Panel.
The first generates a 2-panel accordion
The second generates a 4-panel accordion
The third, generates a 2-panel accordion.
And the amount of tabsPanels and accordionPanels, is loaded from the database.
In the third TabPanel, the accordion works correctly, not so in the first and second TabPanel.
The malfunction is the following
When displaying the TabPanel, by default, the first is shown.
When I click to some other hides the visible, but does not show the content area that I just clicked.
Looking at console output activate event I see the following behavior
When active in the third TabPanel, the activate method is called once
If active in the second TabPanel, the activate method is called 3 times
If active accordionPane _ in the first tabpanel, the activate method is called 7 times
The pattern that I find for that amount of calls is as follows.
In the first TabPanel
4 accordion panel (in the second TabPanel) + 2 accordion panel (in the third TabPanel) + 1 = 7 call
The second tab panel
2 accordion panel (in the third TabPanel) + 1 = 3 calls
Thanks and Sorry for my English