hi all,
I used the below code to delete selected records in grid view ,
in view
$this->widget(‘zii.widgets.grid.CGridView’, array(
'id'=>'employer-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
array(
'id'=>'autoId',
'class'=>'CCheckBoxColumn',
'selectableRows' => '50',
'value'=>$model->EMP_ID,
),
.......
echo CHtml::ajaxSubmitButton(‘Delete Selected’,
$this->createUrl('DeleteSelected'),array(
'type'=>'POST',
'data' => 'js:{ids:$.fn.yiiGridView.getSelection("employer-grid")}',
'success'=>'DispMsg',
));
in controller
public function actionDeleteSelected()
{
foreach ($_POST['ids'] as $modelId)
{
$this->loadModel($modelId)->delete();
}
}
but i dono why it didnt work ,the ‘ids’ was not posted in controller .can anyone help me.Thanks in advance