Good day to all master, i have a problem, i use cjuidialog on my cgridview VIEW button, the scenario is when you click VIEW button the pop up cjuidialog appear, i dont have problem opn this part, but when i try to filter or search on the same cgriview and click VIEW the system will redirect to page that i need to pop up… and thats my problem,
i attached a picture, first picture when i click VIEW button without filter/search, the second picture is my problem when i filter/search.
here is my code:
my controller:
public function actionProcess($id)
{
$model=$this->loadModel($id);
$employee = new CmtProcess;
if(isset($_POST['FacultySched']))
{
$model->attributes=$_POST['FacultySched'];
$employee->attributes=$_POST['CmtProcess'];
$employee->empno=$model->empno;
$employee->sched_id=$model->id;
$employee->checking_time=$employee->checking_time;
$employee->nostud_notecher=$employee->nostud_notecher;
$employee->date_of_absence=$employee->date_of_absence;
if($employee->save())
$this->redirect(array('admin','id'=>$model->id));
}
$this->renderPartial('process', array(
'model' => $model,
'employee' => $employee,
));
Yii::app()->end();
}
my grid view
<?php
$pageSize=Yii::app()->user->getState('pageSize',Yii::app()->params['defaultPageSize']);
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'faculty-sched-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
array(
'class' => 'SCLinkColumnWithSort',
'name'=>'search_lname',
'labelExpression'=>'$data->empno0->lname . ", " .$data->empno0->fname',
'urlExpression'=>'Yii::app()->createUrl("FacultySched/schedule",array("empno"=>$data["empno"]))',
'linkHtmlOptions'=>array('target'=>'_blank'),
'headerHtmlOptions'=>array('style'=>'width: 120px; text-align: center;'),
'header'=>'Full Name',
),
array(
'name'=>'subject',
'headerHtmlOptions'=>array('style'=>'width: 180px; text-align: center;'),
),
array(
'name'=>'search_schoolcollege',
'value'=>'$data->empno0->schoolCollege->name',
'filter'=>CHtml::listData(SchoolCollege::model()->findAll(array('order'=>'name')), 'id', 'name'),
),
'time_from',
'time_to',
'days',
'room',
array(
'class'=>'CButtonColumn',
'header'=>CHtml::dropDownList('pageSize',$pageSize,array(10=>10,20=>20,100=>100),array(
// change 'user-grid' to the actual id of your grid!!
'onchange'=>"$.fn.yiiGridView.update('faculty-sched-grid',{ data:{pageSize: $(this).val() }})",
)),
'template'=>'{view}',
'htmlOptions'=>array(
'width'=>50,
),
'buttons' => array(
'view'=>array(
'label'=>'Process',
'url'=>'Yii::app()->createUrl("FacultySched/Process", array("id"=>$data->id))',
'visible'=> '$data->days != NULL',
'imageUrl'=>Yii::app()->request->baseUrl.'/images/46.png',
'options'=>array('class'=>'open_dialog'),
),
),
),
),
));
?>
<?php
$this->beginWidget('zii.widgets.jui.CJuiDialog',array(
'id'=>'mydialog',
// additional javascript options for the dialog plugin
'options'=>array(
'title'=>'Process',
'modal'=>true,
'autoOpen'=>false,
),
));?>
<?php
$this->endWidget('zii.widgets.jui.CJuiDialog');
?>
<script type="text/javascript">
function open_dialog()
{
// e.preventDefault();
var $this = jQuery(this);
var $d = jQuery('#mydialog').load($this.attr('href')).dialog('open');
return false;
}
jQuery(function(){
jQuery('.open_dialog').click(open_dialog);
});
</script>