how to create db based accordion
Page 1 of 1
How To Create Db Based Accordion how to create db based accordion
#2
Posted 17 May 2013 - 09:31 PM
Rathilesh, on 17 May 2013 - 06:14 AM, said:
how to create db based accordion
After getting your data, you can use CHtml's listData() to format the data, and then use the CJuiAccordion widget to generate an accordion. If for example you have model "Group" and want to display all groups in an accordion list, you could do the following
<?php
$groups = Group::model()->findAll(); // get all groups
$groupsList = CHtml::listData($groups, 'name', 'description'); // format group data as key and value for cjuiaccordion
$this->widget('zii.widgets.jui.CJuiAccordion', array(
'panels'=>$groupsList, // accepts array of keys and values to generate accordion: key is panel heading, value is panel content that opens on heading click
'options'=>array(
'collapsible'=>true,
'active'=>1,
),
'htmlOptions'=>array(
'style'=>'width:500px;'
),
));
?>
Share this topic:
Page 1 of 1

Help











