CJuiDialog: How to set option 'buttons'?

Hi,

I want to set CJuiDialog option ‘buttons’ to display a close and a OK button.

But how do I set this?

As stated here: http://jqueryui.com/demos/dialog/#option-buttons

It should be an object, but the best result I get - displaying a button, but without fuctionality - is this by using an array:


    <?php

    $this->beginWidget('system.zii.widgets.jui.CJuiDialog',

        array(

            'id'=>'dialog'.$this->id,

            // additional javascript options for the dialog plugin

            'options'=>array(

                'title'=>$this->id.' Dialog box 1',

                'width'=> '800px',

                'height' => '600',

                #'position' => 'top',

                'top' => '50px',

                'modal' => true,

                'buttons' => array("Ok"=>'function(){alert("xxx")}'),

                'autoOpen'=>false,

        )));

    ?>



Which generates:


jQuery('#dialogmain').dialog({'title':'main Dialog box 1','width':'800px','height':'600','top':'50px','modal':true,'buttons':{'Ok':'function(){alert(\"xxx\")}'},'autoOpen':false});



Operating system

OS X

Web server

Apache

Browser type

Firefox 3.5, Safari 4

Yii version or SVN revision

1.1-beta

Best regards,

schmunk

try to use following format:

‘buttons’ => ‘js:xxxxxxx’,


'buttons' => array(

                    'Ok'=>'js:function(){alert("ok")}',

                    'Cancel'=>'js:function(){alert("cancel")}',),



You are great! :lol:

Thanks!

Thanks!

I think this should be mentioned in the documentation.

thx~

Tnx, but why hasn’t it been described in the manual yet???

Because no one did it before! :] I’m third person in this thread that thinks, that this information should be included in the manual. And just did it by adding a comment (see bottom of page). This is what comments to the guide are for, aren’t they? :] Cheers!

I’ve tried like this:

‘Clear’=>“jQuery(’#leftContentEditor’).empty()”,

But it didn’t works…and content within the widget isn’t hidden. Something wrong with the script above?? I want use jquery…




'Clear'=>"js:jQuery('#leftContentEditor').empty()",



note the "js:"