Yii Framework Forum: CJuiDialog: How to set option 'buttons'? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CJuiDialog: How to set option 'buttons'? it's an object Rate Topic: -----

#1 User is online   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 569
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 06 December 2009 - 07:34 PM

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/...#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
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#2 User is offline   jerry2801 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 504
  • Joined: 18-November 09

Posted 06 December 2009 - 08:05 PM

*
POPULAR

try to use following format:

'buttons' => 'js:xxxxxxx',
6

#3 User is online   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 569
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 07 December 2009 - 07:24 AM

View Postjerry2801, on 06 December 2009 - 08:05 PM, said:

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!
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
2

#4 User is offline   seb 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 240
  • Joined: 29-June 09

Posted 16 December 2009 - 11:52 AM

View Postjerry2801, on 06 December 2009 - 08:05 PM, said:

try to use following format:

'buttons' => 'js:xxxxxxx',


Thanks!
I think this should be mentioned in the documentation.
1

#5 User is offline   Davidhhuan 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 270
  • Joined: 08-September 09

Posted 16 January 2010 - 02:57 AM

thx~
no pain, no gain...

My Blog : http://cnblogs.com/davidhhuan
My website: http://sharefamily.net/
0

#6 User is offline   Dr0ID 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 10-July 10
  • Location:Russia, Novosibirsk

Posted 09 September 2010 - 03:41 AM

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

#7 User is offline   Trejder 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,197
  • Joined: 06-October 10
  • Location:Southern Poland

Posted 03 January 2011 - 05:26 AM

View PostDr0ID, on 09 September 2010 - 03:41 AM, said:

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!
Proud Cookbook author, though still learning powerful Yii! :] See my generic profile for more information. Cheers!
1

#8 User is offline   yuda 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 39
  • Joined: 23-December 10

Posted 22 March 2011 - 09:35 PM

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...
0

#9 User is offline   Gustavo 

  • Master Member
  • Yii
  • Group: Moderators
  • Posts: 916
  • Joined: 27-July 10
  • Location:Curitiba - Brasil

Posted 04 May 2011 - 12:51 AM

View Postyuda, on 22 March 2011 - 09:35 PM, said:

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:"
--
Extensions:
translate modue - module to handle translations
multiActiveRecord - db selection in models
redisCache - redis cache component
mpCpanel - interact with cpanel api
mUploadify - use uploadify uploader in your application

Gustavo Salomé Silva
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users