hi guys please help me out…What am i doing is creating a dropdown on above of the cgrid view so that when the user selects the no.of rows then that many rows get displayed tin that formmmm…So the basic problem which is occuring is ajax uodate I am using
the following code on onchange event of the dropdown:
Yii::app()->getClientScript()->registerScript(“Group_testpagesize”,"$(’#Group_testpagesize’).change(function(){
$.fn.yiiGridView.update('testwidget', {
type:'Get',
url:encodeURI('index.php?r=group/mygroups&Group[testpagesize]='+$(this).val()),
success:function(data) {
$.fn.yiiGridView.update('testwidget');
},
error:function() {alert('error');
}
});
return false;
});",CClientScript::POS_READY);
1)it is getting refreshed two times
2)it is not updating my records
My search function in the model is
public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
//$this->modified_on=date('Y-m-d',strtotime($this->modified_on));
$userid=Yii::app()->user->getId();
$criteria=new CDbCriteria;
$userid=Yii::app()->user->getId();
$criteria->condition='vuser_id=:vuser_id and delete_flag=:delete_flag';
$criteria->params=array(':vuser_id'=>$userid,':delete_flag'=>'0');
$criteria->compare('id',$this->id);
$criteria->compare('group_title',$this->group_title,true);
$criteria->compare('created_on',$this->created_on,true);
$criteria->compare('modified_on',$this->modified_on,true);
if(isset($_GET['Group']['testpagesize']))
{
echo $pagesize=$_GET['Group']['testpagesize'];
}
else
{
echo $pagesize=5;
}
/*$criteria->compare('delete_flag',$this->delete_flag,true);
*/
return $dataProvider=new CActiveDataProvider('Group',
array('criteria'=>$criteria,
'pagination'=>array('pageSize'=>$pagesize),
)
);
}
the parameters and everythhing is fine but not the updation please helllpppppppppppppppppppppppp asap