Thursday, December 2, 2010

YII » Using JQuery UI Dialog Boxes

In a view, add this (within php tags):

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

echo 'dialog contents here';

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

That's your bare minimum.

Here it is modal, with a title, and an "OK" button that closes the dialog:
$this->beginWidget('zii.widgets.jui.CJuiDialog'
        , array('options'=>array(
            'title'=>'My Title'
            , 'modal'=>true
            , 'buttons'=>array('OK'=>'js:function(){$(this).dialog("close")}')
            ))
);

echo 'I am a modal dialog with an OK button';

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

No comments:

Post a Comment