简体   繁体   中英

yii : how to display CJuiDialog when click button of cgridview?

Q : how to display CJuiDialog when click button of cgridview?

I would like to display the popup when user click the button of cgridview.

This is the button of cgridview

'buttons'=>array(
    'history'=>array(
        'visible'=>'Yii::app()->user->checkAccess("Reviewer") && $data->status == "Reviewing"',
        'url'=>'Yii::app()->createUrl("/history/view", array("id"=>$data->id))',
        'imageUrl'=>Yii::app()->request->baseUrl.'/images/assets/history.png',   
                ),

But I'm really don't know how to do it. pls help me.

First you setup the CJuiDialog:

$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
    'id'=>'mydialog',
    // additional javascript options for the dialog plugin
    'options'=>array(
        'title'=>'Dialog box 1',
        'autoOpen'=>false,
    ),
));

echo 'dialog content here';

$this->endWidget('zii.widgets.jui.CJuiDialog');

Then you use the element 'click' of $buttons:

'click'=>'$("#mydialog").dialog("open"); return false;',

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM