Check and Uncheck All Checkboxes

hi all,

  I need to implement select all and unselect all for the list of checkboxes in a page.

I am able to display the data with chechboxes. Now i want the user to be provided with the provision of at a time selecting all checkboxes and deselection.

the code is

 <?php $this->widget('zii.widgets.grid.CGridView',array(


'dataProvider' =>$dataProvider,

'columns' => array(


      'name' =>'',

      'value' => 'CHtml::checkBox("id[]",null,array("value"=>$data->id,"id"=>"rid_".$data->id))',


      'htmlOptions' => array('width'=>5),

      'visible' => !Yii::app()->user->isGuest,






        'class' => 'CButtonColumn',

        'viewButtonUrl' => 'Yii::app()->createUrl("Flatchargesmapping/view",array("id"=>$data["id"]))',





help me please.

Can I suggest you use the CCheckBoxColumn - It was made for this situation.

Don’t forget to set the ‘selectableRows’ property to the number of rows you have in your table, otherwise the ‘select all’/‘deselect all’ will not be available.