问:如何从 cgridview 中获取复选框值?
状态:我使用 CJuiDialog 在弹出框中创建 cgridview。但我无法从网格视图中获取复选框的值。我收到 500 错误。
这是我打开弹出框的视图
<div style="height:50px;">
<?php $imghtml=CHtml::image(Yii::app()->request->baseUrl.'/images/assets/approver.png','', array('style'=>'margin: 5px 0;')); ?>
<?php echo CHtml::ajaxLink(
Yii::t('accrecei',$imghtml),
$this->createUrl('implementer/Approverlist', array('id'=>$model->id)),
array(
'onclick'=>'$("#accreceilist").dialog("open"); return false;',
'update'=>'#reviewerlist'
),
array(
'id'=>'showaccreceilist',
'class'=>'btn btn-info',
'title'=>'Add/Remove reviewer',
'style'=>'width:25px; float:right; margin-button:20px;',)
);?>
<div id="reviewerlist"></div>
</div>
这是弹出框
<?php
$this->beginWidget('zii.widgets.jui.CJuiDialog',array(
'id'=>'reviewerlist',
'options'=>array(
'title'=>Yii::t('accrecei','Reviewer List'),
'autoOpen'=>true,
'modal'=>'true',
'width'=>'750',
'height'=>'500',
),
));
//echo $this->renderPartial('_listing', array('model'=>$model, 'acccategory'=>$acccategory,'job'=>$job)); ?>
<?php $this->renderPartial('_listing',array('model' => $model,'arr_reviewer' => $arr_reviewer, 'current_reviewers'=> $current_reviewers),false,true); ?>
<?php $this->endWidget('zii.widgets.jui.CJuiDialog');?>
这是网格视图“_listing.php”
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'job-form',
'enableAjaxValidation'=>true,
)); ?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'acc-recei-grid',
'dataProvider'=>$model->search_reviewerlist(),
'filter'=>$model,
'columns'=>array(
array(
'class' => 'CCheckBoxColumn',
'selectableRows' => 2,
'checkBoxHtmlOptions' => array(
'name' => 'userids[]',
),
'value'=>'$data->id',
//'checked'=>'(in_array($data->id, $current_reviewers) ? 1 : ""',
'checked'=>function($data, $row) use ($current_reviewers){
return in_array($data->id, $current_reviewers);
}
),
'username',
array(
'type'=>'raw',
'value'=>'$data->id',
//'filter'=>array('style'=>'visible:none'),
//'headerHtmlOptions'=>array('style'=>'width:0px; display:none; border:none; textdecoration:none'),
'htmlOptions'=>array('style'=>'display:none; border:none;', 'class'=>'user-id'),
//'header'=>false,
//'filter'=>false,
),
),
)); ?>
<div align="center">
<?php echo CHtml::ajaxSubmitButton(Yii::t('reviewer','Update'),Yii::app()->createUrl('implementer/updatereviewer',array('id'=>$model->id)),array('success'=>'js: function(data) {
$("#reviewerlist").dialog("close");
}'),array('id'=>'closeJobDialog')); ?>
</div>
<?php $this->endWidget(); ?>
这是我获取复选框值的控制器功能
public function actionUpdatereviewer()
{
var_dump($_POST['userids']);
echo 'debug';
echo $_GET['id'];
die;
}
感谢您的任何建议。