jeudi 28 septembre 2017

How to use a CJuiAccordion Panel with checkboxes in Yii?

I have a panels with different sections. I want the user to be able to select(with a checkbox different selections and all be saved in one field filter. I have it set up and working. However, it is only saving the selections of the last panel to the database. Has anyone had experience using panels with checkboxes in Yii?

Here is my form (in view)

 <div>
    <?php echo $form->labelEx($model,'filters');?>
    <?php
    $id = $modelA->id;
    $groups = ClassGroups::model()-
         >findAll(array("condition"=>"id=$id","order"=>"id"));
    $panels = array();
    foreach($groups as $group)
    {
        $panels[$group->class->name] = $this-
    >renderPartial('_cat',array('model'=>$model, 'pID'=>$group-
      >filter_id),true);
    }

    $this->widget('zii.widgets.jui.CJuiAccordion',array(
    'panels'=>$panels,
    'options'=>array(
        'collapsible'=> true,
        'animated'=>'bounceslide',
        'autoHeight'=>true,
        'style'=>array('minHeight'=>'10'),
        'active'=>true,
    ),

    ));

    ?>
    <?php echo $form->error($model,'filters'); ?>  
</div>

Here is my _cat file which is used in the renderPartial

<?php
$listID = "list_" + $pID;
echo CHtml::activeCheckBoxList($model, 'filters',
        CHtml::listData(
            Class::model()->findAll(
                array("condition"=>"pID=$pID","order"=>"name")),
                'id',
                'name'
            ), 
            array()
       );
?>




Aucun commentaire:

Enregistrer un commentaire