i have a Cgrid view Which i am showing with ajax call and with the help of renderPartial view
In this Cgrid view i have a CCheckBoxColumn.
my whole application is running with Ajax calls and renderPartial views.So, When call ajax for first time and load a renderPartial view then perform a selection of checkboxes and hit a ajax Button for any other ajax call(Delete a multiple records) then it render a same Cgrid view with a updated results.
But then i try to select a checkboxes then only a main CheckBox(Which perform select All checkbox) is working like checked All or unchecked All.But child check boxes are not selectable individually.
I have a one more button which peform a Add record Ajax call which load a CActivForm to add a record.So,After Adding a record it again load that View which contain a Gird View with CCheckBoxColumn.So, when i try to select an individual checkbox then its not working.Only select All or unselect All action can be performed.
I know it is just an issue of redundancy of scripts.But i have already tired with
Yii::app()->clientScript->scriptMap=array("jquery.js"=>false, 'duplicatedScrip.js'=>false)
But its not working for me.
Here is my code
For Controller :-
public function actionChangeDropdownView($dropdown){
switch ($dropdown){
case 'state':
if(Yii::app()->request->isAjaxRequest)
{
Yii::app()->clientscript->scriptMap=array("jquery.js"=>false, 'duplicatedScrip.js'=>false);
}
$dataProvider=new CActiveDataProvider('State', array(
'pagination'=>array(
'pageSize'=>15,
)));
$this->renderPartial('_loadstate',array('dataProvider'=>$dataProvider),false,true);
break;
case 'costUnit':
if(Yii::app()->request->isAjaxRequest)
{
Yii::app()->clientscript->scriptMap=array("jquery.js"=>false, 'duplicatedScrip.js'=>false);
}
$dataProvider=new CActiveDataProvider('Unit', array(
'pagination'=>array(
'pageSize'=>15,
)));
$this->renderPartial('_loadunit',array('dataProvider'=>$dataProvider),false,true);
break;
case 'industry':
if(Yii::app()->request->isAjaxRequest)
{
Yii::app()->clientscript->scriptMap=array("jquery.js"=>false, 'duplicatedScrip.js'=>false);
}
$dataProvider=new CActiveDataProvider('Industry', array(
'pagination'=>array(
'pageSize'=>15,
)));
$this->renderPartial('_loadindustry',array('dataProvider'=>$dataProvider),false,true);
break;
}
}
public function actionAddStateProcess(){
$model= new State('addState');
$model->scenario='addState';
if(isset($_POST['State']))
{
$model->attributes=$_POST['State'];
$model->save();
}
if(Yii::app()->request->isAjaxRequest)
{
Yii::app()->clientscript->scriptMap=array("jquery.js"=>false, 'duplicatedScrip.js'=>false);
}
$dataProvider=new CActiveDataProvider('State', array(
'pagination'=>array(
'pageSize'=>15,
//'params' => array('city' => $cityId,'sortby'=>$sortBy),
)));
$this->renderPartial('_loadstate',array('dataProvider'=>$dataProvider),false,true);
}
For View File :-
echo CHtml::beginForm('','post',array('id'=>'state-list-form'));
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider,
'id'=>'stateGird',
'selectableRows'=>2, // multiple rows can be selected
'columns'=>array(
array(
'class'=>'CCheckBoxColumn',
'id'=>'checkState',
),
// 'id',
'state_name',
/*
* array( // display a column with "view", "update" and "delete" buttons
'class'=>'CButtonColumn',
// 'template'=>'{delete}',
),
*/
),
));
echo CHtml::endForm();
I hope somebody will provide a stable solution for it.Its a wired problem for me.
Waiting for some good suggestion.
Thanks in Advance
jayant