cgridViewtable中有两个列复选框,视图页面中有两个引导小部件TbButton。
我不能很好地得到我的复选框的价值。我在校验盒中的值转换为控制器,但经过一段时间后更改了支票盒的id,并且控制器不知道复选框,
查看:
$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();主计长:
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吗?
发布于 2014-08-18 13:38:52
我可以为复选框分配id吗?--当然,最好显式设置复选框列id:'class' => 'CCheckBoxColumn', 'id'=>'column1', ...参见这些医生。这样你就不会有像yt0,yt2这样的东西.你也可以做同样的按钮。见TButton文档。
此外,您还需要在逻辑条件下使用双&&:isset($_POST['profile-information-grid_c12']) & isset($_POST['yt1'])
https://stackoverflow.com/questions/25102878
复制相似问题