checkBoxList

I need some help for changing the checkBoxList. I want that the ‘check all’ radio by default is selected.

How to achieve this?




<?php echo MyCHtml::checkBoxList('Categories', 

        $categories,

        CHtml::encodeArray(CHtml::listData(Category::model()->findAll(),

        'IdCategory',

        'Category')

    ),

    array('template' => '<li>{input} {label}</li>',

        'separator' => '',

        'checkAll' => 'Alle rubrieken')

    );

?>



I think you must to extend this class to do this in the right way

found about extending http://www.yiiframework.com/forum/index.php?/topic/8769-extending-chtmlcheckboxlist/

@ignis You sent bas_vdl to his own post :D

upps

well you can do this by writting some js or just with this little ‘hack’







$myData = CHtml::encodeArray(CHtml::listData(Category::model()->findAll();


$myData = empty($myData) ? categories : $myData;




echo MyCHtml::checkBoxList('Categories', 

        $categories,

        $myData,

        'IdCategory',

        'Category')

    ),

    array('template' => '<li>{input} {label}</li>',

        'separator' => '',

        'checkAll' => 'Alle rubrieken')

    );



Or you can wait for more advanced users answer