0

如何在 Gridview 中弹出一个新的 Windwon?

当使用单击gridview的退款按钮时,我想显示带有数据的弹出框。我能怎么做?

这是我的网格视图

<?php $this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'advance-grid',
    'dataProvider'=>$model->search(),
    'filter'=>$model,
    'columns'=>array(

        array('name' => 'acc_category_id',
               'value'=>'(isset($data->acccategories->name)) ? CHtml::encode($data->acccategories->status) :"Not Set"',
               'filter'=>CHtml::listData($acccate, 'id', 'name'),
        ),
        array('name' => 'accmain_id',
               'value'=>'(isset($data->accmains->name)) ? CHtml::encode($data->accmains->name) :"Not Set"',             
               'filter'=>CHtml::listData($accmain, 'id', 'name'),
        ),
        array('name' => 'job_id',
               'value'=>'(isset($data->jobs->name)) ? CHtml::encode($data->jobs->name) :"Not Set"',             
               //'filter'=>CHtml::listData($job, 'id', 'name'),
        ),
        'currency',
        'amount',


        array('name' => 'created_date',
               'value'=>'Yii::app()->dateFormatter->format("d MMM y",strtotime($data->created_date))',              
              // 'filter'=>CHtml::listData($job, 'id', 'name'),
        ),
        array(
            'class'=>'CButtonColumn',
            'template'=>'{update} {delete} {refund}',
            'buttons'=>array
            (   

                'update' => array
                (
                    'imageUrl'=>Yii::app()->request->baseUrl.'/protected/assets/images/gridview/edit.gif',
                    'options'=>array('style'=>'width:10px; border:none;'),
                    'url'=>'Yii::app()->createUrl("advance/update", array("id"=>$data->id))',
                ),
                'delete' => array
                (
                    'imageUrl'=>Yii::app()->request->baseUrl.'/protected/assets/images/gridview/delete.gif',
                    'options'=>array('style'=>'width:10px; border:none;'),
                    'url'=>'Yii::app()->createUrl("advance/delete", array("id"=>$data->id))',
                ),   

                'refund' => array
                (
                    'type'=>'raw',
                    'imageUrl'=>Yii::app()->request->baseUrl.'/protected/assets/images/gridview/icon_refund_loans2.gif',
                    'options'=>array('style'=>'width:10px; border:none;'),
                    'url'=>'Yii::app()->createUrl("advance/view", array("id"=>$data->id))',
                ),  


            ),
        ),
    ),
    'htmlOptions' => array(
        //'class' => 'table table-bordered table-striped table_vam grid_widget',
    ),
)); ?>

<div id="loadingdiv" style="float:right; margin-right:160px;">&nbsp;</div>
            <div id="jobslist"></div>

======================================

更新

当我通过跟随并通过萤火虫检查来更新网格时,它正在萤火虫中显示数据。但不显示弹出窗口。

array(
            'header'=>'Refund',
            'type'=>'raw',
            'value'=>'CHtml::ajaxLink($data->id, array("advance/jobslist", "id"=>$data->id), array("onclick"=>\'$("#jobslist").dialog("open"); return false;\'));',

        ),

这是控制器

public function actionJobslist()
    {
        $model=new Job('search');
        $model->unsetAttributes();  // clear any default values
        if(isset($_GET['Customer']))
            $model->attributes=$_GET['Customer'];

        if(isset($_GET['AccRecei']))
            $accrecei->attributes=$_GET['AccRecei'];

        $this->renderPartial('jobs_listing',array('model'=>$model),false,true);

    }

这是视图/jobs_listing.php

<?php 
$this->beginWidget('zii.widgets.jui.CJuiDialog',array(
                'id'=>'jobslist',
                'options'=>array(
                    'title'=>Yii::t('job','Jobs List'),
                    'autoOpen'=>true,
                    'modal'=>'true',
                    'width'=>'750',
                    'height'=>'500',
                ),
                ));
echo $this->renderPartial('_jobs_listing', array('model'=>$model)); ?>
<?php $this->endWidget('zii.widgets.jui.CJuiDialog');?>

我应该怎么做?

4

2 回答 2

1
array(
            'header'=>'Refund',
            'type'=>'raw',
            'value'=>'CHtml::link($data->id, array("id"=>$data->id, 'class'=>'view-popup'));',
        ),

并插入javascript:

$('.view-popup').live('click', function() {
        var id = $(this).attr('id');
        window.open("<?php echo 'http://'.$_SERVER['HTTP_HOST'].'/your_path/id/'; ?>" + id,'popUpWindow','height=800,width=1000,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes');
        return false; 
    });
于 2013-01-28T08:30:16.033 回答
0

网格内部

array(
            'header'=>'Refund',
            'type'=>'raw',
            'value'=>'CHtml::ajaxLink($data->id, array("advance/jobslist", "id"=>$data->id), array(
            "onclick"=>"$(\"#jobslist\").dialog(\"open\"); return false;","update"=>"#jobslist",
            "beforeSend" => "function() {           
                $(\"#loadingdiv\").addClass(\"ajaxloading\");
            }",
            "complete" => "function() {
                $(\"#loadingdiv\").removeClass(\"ajaxloading\");
            }", 
            ),array("id"=>"showcustomerlist2"));',

        ),

出格

<div id="loadingdiv" style="float:right; margin-right:160px;">&nbsp;</div>
            <div id="jobslist2"></div>
于 2013-01-27T17:37:44.850 回答