Search code examples
phpyii

How to get the checkbox to appear in entire column PHP Yii1.1


I am trying to make the checkbox appear in the entire column of my view. However, I am a little lost as to the 'value' of said column. As of right now, I have no clue what I need to enter to make the checkbox appear in the entire column at all.

Any help or advice is appreciated. Below is the code I have written so far.

$this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'ServiceDataProvider',
    'dataProvider'=>$model->search(),
    'cssFile' => false,
    'filter'=>$model,
    'columns'=>array(
        array(
            'header'=>'Affected Groups',
            'value'=>'displayGroupName($data->groups)',
            'name'=>'groups.description',
            'filter'=>CHtml::textField('groups.description', Yii::app()->request->getParam('groups.description'))
        ),
        array(
            'header'=>'Affected Hosts',
            'value'=>'displayHostName($data->hosts)',
            'name'=>'hosts.hostname',
            'filter'=>CHtml::textField('hosts.hostname', Yii::app()->request->getParam('hosts.hostname'))
        ),
        array(
            'name'=>'servicedescription',
        ),
        array(
            'class'=>'CButtonColumn',
            'template'=>'{delete}',
            'deleteButtonUrl'=>'Yii::app()->createUrl("path/to/delete",
                array("id"=>$data["idservice"]))',
        ),
        array( 
            'value'=>'', // AND this is the part where I have no clue what to do.
            'id'=>'selectServices',
            'header'=>'<input id="services_all" type="checkbox" title="Select multiple services to dele" data-toggle="tooltip"/>',
            'headerHtmlOptions'=>array(
                'class'=>'checkbox-column'
            ),
        ),
    ),
));

Thanks for your help, fellas. I really appreciate it.


Solution

  • Never mind. It's probably still early or something. This is how I solved it with version Yii 1.1.21:

     array(
                'value'=>'$data->idservice',
                'class'=>'CCheckBoxColumn',
                'id'=>'selectServices',
                'headerTemplate'=>'{item}',
                'selectableRows'=>'2',
            ),