more than one jquery-ui dialog

Hi,

i have the following two times with different ID’s. But only the first one opens in a dialog.

What is it i am doing wrong?




            <div>

                <?php

                    echo CHtml::ajaxLink(

                            'Button',

                            $this->createUrl('myController/myAction', array()),

                            array(

                                'onclick'=>'$("#addDialog").dialog("open"); return false;',

                                'update' =>'#addDialog',

                                ),

                            array('id'=>'showDialog')

                         );

                ?>

            </div>

            <div id="addDialog"></div>



If you wont to have multiple dialogs you must have more then one widget,

only solution for more dialog widget in same time to be opend is as many you dialog wont to open you have to setup that much dialogs eg. below

(i don`t suggest this, better is second solution)




 <?php

$this->widget('zii.widgets.CMenu',array(

'items'=>array(

array('label'=>'TEST1', 'url'=>'#','linkOptions'=>array( 'onclick'=>'$("#dialogone").dialog("open"); return false;')

),


array('label'=>'TEST2', 'url'=>'#','linkOptions'=>array( 'onclick'=>'$("#dialogtwo").dialog("open"); return false;')

),

array('label'=>'TEST3', 'url'=>'#','linkOptions'=>array( 'onclick'=>'$("#dialogthree").dialog("open"); return false;')

),


));

?>


<?php

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

    'id'=>'dialogone',

    'cssFile'=>'jquery-ui-1.8.6.custom.css', //exzample customtheme

    'theme'=>'custom-theme', //exzample customtheme

    'themeUrl'=>Yii::app()->request->baseUrl.'/css/ui', //exzample customtheme

    'options'=>array(

        'title'=>'Title1',

        'autoOpen'=>false,

        

    ),

));

//your code hire 

//your code hire 

//your code hire 

//your code hire 

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


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

    'id'=>'dialogtwo',

    'cssFile'=>'jquery-ui-1.8.6.custom.css', //exzample customtheme

    'theme'=>'custom-theme', //exzample customtheme

    'themeUrl'=>Yii::app()->request->baseUrl.'/css/ui', //exzample customtheme

    'options'=>array(

        'title'=>'Title2',

        'autoOpen'=>false,

        

    ),

));

//your code hire 

//your code hire 

//your code hire 

//your code hire 

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





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

    'id'=>'dialogthree',

    'cssFile'=>'jquery-ui-1.8.6.custom.css', //exzample customtheme

    'theme'=>'custom-theme', //exzample customtheme

    'themeUrl'=>Yii::app()->request->baseUrl.'/css/ui', //exzample customtheme

    'options'=>array(

        'title'=>'Title3',

        'autoOpen'=>false,

        

    ),

));

//your code hire 

//your code hire 

//your code hire 

//your code hire 

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


?>



Below for me is best approach:

if you dont wont to have many dialog , but you wanna have many dialog calls and just one dialog eg.below





<?php

$url = $this->createAbsoluteUrl('site/test');

$script = "jQuery(function($) {

jQuery('body').delegate('.getid', 'click', function(){


var ids = jQuery(this).attr('id');

jQuery.ajax({

type: 'GET',

url: '".$url."',

data: 'id='+ids,

success: function(data, textStatus, XMLHttpRequest){jQuery('#upids').html(data);}

});


});

});";

Yii::app()->clientScript->registerScript(1,$script,CClientScript::POS_END);


/*

you can use hire also

CHtml::link()


*/

echo CHtml::image(Yii::app()->request->baseUrl.'/image/arrow.png','Message 1',array('id'=>1,'class'=>'getid','onclick'=>'$("#egz").dialog("open");'));

echo CHtml::image(Yii::app()->request->baseUrl.'/image/arrow.png','Message 2',array('id'=>2,'class'=>'getid','onclick'=>'$("#egz").dialog("open");'));

echo CHtml::image(Yii::app()->request->baseUrl.'/image/arrow.png','Message 3',array('id'=>3,'class'=>'getid','onclick'=>'$("#egz").dialog("open");'));




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

    'id'=>'egz',

    'cssFile'=>'jquery-ui-1.8.6.custom.css',//exzample customtheme


    'theme'=>'custom-theme',//exzample customtheme


    'themeUrl'=>Yii::app()->request->baseUrl.'/css/ui',//exzample customtheme


    'options'=>array(

        'title'=>'example',

        'autoOpen'=>false,

        

    ),

));


echo '<div id="upids"></div>';

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

?>



all examples tested and works

Thank you very much!

It works !!!!

i have try it, but it doesn’t work