You'll want to call the .dialog(options) only once - that's your init. Since
you're using the autoOpen: false option, you'll later call the open method
$("#dialog").dialog("open")
After init you can change any options (including buttons) by the following
API:
If you're using 1.5
$("#dialog").data("buttons.dialog", {
"Confirm": function() { $(this).empty(); },
"Close": function() { $(this).dialog("close"); }
});
In 1.6 we deprecated the .data("optionname.pluginname", [newVal]) syntax and
added an option method to each plugin, like so
$("#dialog").dialog("option", "buttons", {
"Confirm": function() { $(this).empty(); },
"Close": function() { $(this).dialog("close"); }
});
In either case if you don't provide the final parameter (the new value) it
will act as a getter and you can retrieve the current value.
- Richard
On Wed, Feb 4, 2009 at 9:48 AM, Xobb <[email protected]> wrote:
>
> Hello guys,
>
> I'm new to jQuery UI. I have the interface that can use only one
> dialog at once, but the dialog buttons need to be changed depending on
> the method that initiated the dialog.
> This is how I define th dialog:
>
> $('#dialog').dialog({
> bgiframe: true,
> autoOpen: false,
> width: 600,
> show: 'clip',
> hide: 'clip',
> resizable: false,
> modal: true,
> close: function() {
> $(this).empty();
> }
> });
>
> Then when the I need to open the actual dialog window:
>
> $('#dialog').dialog({buttons: {
> "Close": function() {
> $(this).dialog("close");
> }}});
>
> or
>
> $('#dialog').dialog({buttons: {
> "Confirm": function() {
> $(this).empty();
> },
> "Close": function() {
> $(this).dialog("close");
> }}});
>
> depending on the action that pops up the dialog. The problem is that
> the dialog opens, but without buttons. I'm using the 1.6rc6
>
> Any ideas?
>
> Thanks,
> Xobb
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---