Yii Framework Forum: checkBoxList - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

checkBoxList checkAll is checked by defaut Rate Topic: ****- 1 Votes

#1 User is offline   bas_vdl 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 215
  • Joined: 01-April 09

Posted 31 October 2010 - 02:02 PM

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')
    );
?>

0

#2 User is offline   ignis 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 57
  • Joined: 27-April 10
  • Location:Lithuania - Vilnius

Posted 31 October 2010 - 02:35 PM

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

found about extending http://www.yiiframew...mlcheckboxlist/
0

#3 User is offline   got 2 doodle 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 248
  • Joined: 12-December 08
  • Location:Beautiful Nova Scotia, Canada

Posted 31 October 2010 - 06:49 PM

@ignis You sent bas_vdl to his own post :D
Check out myYii powered website
0

#4 User is offline   ignis 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 57
  • Joined: 27-April 10
  • Location:Lithuania - Vilnius

Posted 01 November 2010 - 01:49 AM

upps Posted Image

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
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users