Submit CGridView Checked values using a form

后端 未结 3 1079
猫巷女王i
猫巷女王i 2021-01-20 08:03

I have a CGridView wigdet with CCheckBoxColumn like this:

$this->widget(\'zii.widgets.grid.CGridView\', array(
    \'dataProvider\'=>$dataProvider,
            


        
3条回答
  •  北海茫月
    2021-01-20 08:32

    If you wrap your Gridview into a simple form you can send the checkboxs selected to the value,

    An example:

    View

    findAll(), 'USER_ID', 'FULLNAME') ); echo CHtml::ajaxSubmitButton('Save' , Yii::app()->createUrl('query/ajaxUpdate') , array('success' => 'js:reloadGrid', ) , array('class' => 'btn btn-success')); $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'query-grid', 'dataProvider'=>$model->search(), 'filter'=>$model, 'columns'=>array( array( 'id' => 'query', 'class'=>'CCheckBoxColumn', 'selectableRows' => '2', ), 'Contact', 'Email', 'Company', ), )); ?>

    Controller

    public function actionAjaxUpdate()
    {
        var_dump($_POST);
    }
    

提交回复
热议问题