Any one Please help me!!!
In the link
http://www.yiiframework.com/forum/index.php/topic/24285-mass-action-yii-checkbox-cgridview/
bulk delete action shown, I need the same functionality for bulk update,
Like … After selecting the rows using check boxes and click the button updateAll the screen to be shown with some fields with a save button, after filling the fields then save clicked the selected records should be updated Please help me !!!
<?php
public function actionUpdateall()
{
if (isset($_POST['mymodel-grid_c0']))
{
$upd_mod = $_POST['mymodel-grid_c0'];
$uname=Yii::app()->user->name;
$baseUrl = Yii::app()->baseUrl;
$cs = Yii::app()->getClientScript();
$cs->registerScriptFile($baseUrl.'/js/utility.js');
$cs->registerScriptFile($baseUrl.'/js/validations.js');
$model = new Mymodel;
$cnt=count($_POST);
$isinw = isset($_POST['mymodel']);
//if(isset($_POST['mymodel']))
Dialog::message('title',"count is $cnt and $isinw");
if($cnt<1)
{
$model->attributes=$_POST['Mymodel'];
if($uname<>'recorduser' and
($model->fno!='' or $model->fno!=null) or
($model->year!='' or $model->year!=null))
$model->scenario='PR';
if(($uname==='recorduser') and $model->clo_yn==='Y')
$model->scenario='finalization';
if($model->validate()){
foreach ($upd_mod as $pk){
$umodel = Mymodel::model()->findByPk($pk);
if($umodel->updateallFields($model)){
$umodel->save();
}
}
//$this->actionAdmin();
$this->render('admin',array(
'model'=>$model,
));
}else{
Dialog::message('ERROR', "unable to save $cnt");
}
}else{
$this->render('updateall',array(
'model'=>$model,
));
}
}
else
{
//Yii::app()->user->setFlash('error', 'Please select at least one record to Update.');
Dialog::message('ERROR', "Please select at least one record to Update.");
$model = new Mymodel;
$this->render('admin',array(
'model'=>$model,
));
}
}
?>
In the above one, how to render the view updateall and then save batch update the screen having the fno,yr and some other fields these fields to be batch updated.
Kindly help!!!
the isset($_POST[‘mymodel’]) is not rendering the view…