首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >更改CGridView中的id复选框

问更改CGridView中的id复选框
EN

Stack Overflow用户
提问于 2014-08-03 08:18:24
回答 1查看 274关注 0票数 2

cgridViewtable中有两个列复选框,视图页面中有两个引导小部件TbButton。

我不能很好地得到我的复选框的价值。我在校验盒中的值转换为控制器,但经过一段时间后更改了支票盒的id,并且控制器不知道复选框,

查看:

代码语言:javascript
复制
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
    'id' => 'profile-information-form',
    'enableAjaxValidation' => false,
        ));

$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => Yii::t('fa_ir', 'First validation'),));

   $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => Yii::t('fa_ir', 'End validation'),));



 $this->widget('zii.widgets.grid.CGridView', array(
        'id' => 'profile-information-grid',
        'dataProvider' => $model->children(),
        'filter' => $model,
        'columns' => array(
            array(
                'header' => '',
                'value' => '$this->grid->dataProvider->pagination->offset + $row+1', //  row is zero based
            ),
            array(
                'name' => 'ProfileInformation.user.scope',
                'value' => 'CHtml::encode($data->user->scope->name)',
                'filter' => Scope::model()->options,
            ),

            array(
                'name' => 'id',
                'value' => 'CHtml::encode($data->id)',
            ),
            array(
                'name' => 'center',
                'value' => 'CHtml::encode($data->center)',
            ),

            array(
                'name' => 'sendCount',
                'value' => 'CHtml::encode($data->sendCount)',
                'filter' => '',
            ),
            // Use CCheckbox column with selectableRows = 2 for Select All

            array('class' => 'CCheckBoxColumn', 'selectableRows' => 2, 'visible' => (Lookup::isUser2(Yii::app()->user->id) or Lookup::isAdmin(Yii::app()->user->id))),


            array('class' => 'CCheckBoxColumn', 'selectableRows' => 2, 'visible' => (Lookup::isUser1(Yii::app()->user->id) or Lookup::isAdmin(Yii::app()->user->id))),


        ),
    ));

// action button  

    $this->endWidget();

主计长:

代码语言:javascript
复制
if (isset($_POST['profile-information-grid_c10']) & isset($_POST['yt0'])) {

            ////Do action1
        }
        if (isset($_POST['profile-information-grid_c12']) & isset($_POST['yt1'])) {
            ////Do action2
            }
        }

我的问题是在$_POST‘概要-信息-网格_c10’和_POST‘配置文件-信息-网格_c12’之前id是$_POST‘配置文件-信息-网格_c8’和$_POST‘配置文件-信息-网格_c10’,现在是$_POST‘配置文件-信息-网格_c12’和$_POST‘配置文件-信息-网格_c14’。

我的问题牵涉其中。我不能解释得很好。

我想要一个固定身份。为什么要更改复选框的id?

我可以为支票箱分配I吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-08-18 13:38:52

我可以为复选框分配id吗?--当然,最好显式设置复选框列id:'class' => 'CCheckBoxColumn', 'id'=>'column1', ...参见这些医生。这样你就不会有像yt0,yt2这样的东西.你也可以做同样的按钮。见TButton文档。

此外,您还需要在逻辑条件下使用双&&:isset($_POST['profile-information-grid_c12']) & isset($_POST['yt1'])

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25102878

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档