Hi,

I need to set programmatically the buttons in a confirm buttoned
dialog, but I am having several issues:

This is the code I'm using:

The function that creates and opens the dialog:

        function ModalConBotones(Texto,botones,dialogID){
                $('#'+dialogID).dialog({
                        modal: true,
                        autoOpen: false,
                        addClass: 'ModalInfo',
                        resizable: false,
                        overlay: {
                                opacity: 0.5,
                                background: 'black'
                        },
                        buttons: botones,
                        height:150,
                        width:400
                });
                $('#'+dialogID).html(Texto);
                $('#'+dialogID).dialog("open");
        }

And then I call it from several places:

function1(){
        var buttonsF1 = {};
        buttonsF1 ["buttonF1_1"] = function(){
                                                   //do something
                                                   $(this).dialog("close");
                                                  });
        buttonsF1 ["buttonF1_2"] = function(){
                                                   //do something
                                                   $(this).dialog("close");
                                                  });
       ModalConBotones("TextoF1",buttonsF1,'InfoDialogBoton');
}

function2(){
        var buttonsF2 = {};
        buttonsF2 ["buttonF2_1"] = function(){
                                                   //do something
                                                   $(this).dialog("close");
                                                  });
        buttonsF2 ["buttonF2_2"] = function(){
                                                   //do something
                                                   $(this).dialog("close");
                                                  });
       ModalConBotones("TextoF2",buttonsF2,'InfoDialogBoton');
}

The issue:
When I call function1, everything shows ok, a dialog with TextF1 and
buttonsF1. Perfect.
When I call function2, I get a dialog with TextF2 (perfect), but the
buttons are buttonsF1!!!!!!!

I've tried calling dialog("destroy") in ModalConBotones before
initializing the dialog, but then, the neither TextF1 or TextF2
appears. With firebug I have seen that the dialog keeps
style="display:none"

Any idea?

I think I could change with jquery the style to display: block when I
initialize the dialog, but I think this is not smart enough.

Thanks for your time, hope it was clear enough.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to