【问题标题】:How to get the checkbox to appear in entire column PHP Yii1.1如何让复选框出现在整个列 PHP Yii1.1
【发布时间】:2021-09-01 08:29:15
【问题描述】:

我试图让复选框出现在我的视图的整个列中。但是,我对所述专栏的“价值”有点迷茫。截至目前,我完全不知道需要输入什么才能使复选框出现在整个列中。

感谢任何帮助或建议。下面是我目前写的代码。

$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'
            ),
        ),
    ),
));

感谢您的帮助,伙计们。我真的很感激。

【问题讨论】:

    标签: php yii


    【解决方案1】:

    没关系。可能还早什么的。 这就是我用 Yii 1.1.21 解决的方法:

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

    【讨论】:

      猜你喜欢
      • 2011-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-30
      • 1970-01-01
      • 2019-11-26
      • 2023-02-24
      • 1970-01-01
      相关资源
      最近更新 更多