CJuiDialog to heritage events from jQueryUI

Hi:

How can I use the "events" from jQueryUI dialog in the CJuiDialog ?

I would like to implement this:

stackoverflow.com/ questions/4887332/disable-browser-scrolling-while-jquery-ui-modal-dialog-is-open

(sorry, my first topic … no links allowed :P )

p.d. if possible in all my cjuidialogs (that means, in main configuration file)

Thank you !

noone ? :(

Hello. According to the docs:

Have you tried that?

In the components array of main configuration I use this:




'widgetFactory' => array(

            'widgets' => array(

                'CJuiDialog' => array('options' => array('open' => "function(event, ui) {alert('test open'); }", 'modal' => true, 'draggable' => false)),

            ),

        ),



but it does not work.

I think it’s because when you declare a jqueryui element you can just pass options, no events !

Events are declared after declaring it (jqueryui.com/demos/dialog/#event-create)

The thing is that jQuery allows to put the "open" in the options:

jsfiddle.net/ZGqdc/

But Yii extension does not pass to it …

I found the problem:

When I put this in the configuration:


'widgetFactory' => array(

            'widgets' => array(

                'CJuiDialog' => array('options' => array('open' => 'function(event, ui) {alert('test open'); }', 'modal' => true, 'draggable' => false)),

            ),

        ),

it turns to this options array when the dialog is created:


'open': 'function(event, ui) {alert('test open'); }',

'closeOnEscape': true,

'modal':true,

'draggable':false

But for jQueryUI , the "open" definition needs to be without quotes:


'open': function(event, ui) {alert('test open'); },

'closeOnEscape': true,

'modal':true,

'draggable':false

So, I don’t know if this is a new feature or a bug … but maybe you can check if the “string” is a javascript function or not, and apply the quotes in each case.

Solved.

You must use "js:" before to "remove the quotes"


                'CJuiDialog' => array('options' => array('open' => 'js:function() { alert(jQuery) }', 'closeOnEscape' => true, 'modal' => true, 'draggable' => false)),



I wish to know where this is documented…