Fix custom buttons with no template not working

This commit is contained in:
Nathan Gray 2013-04-22 22:56:55 +00:00
parent 5e84ddd935
commit 516872e322

View File

@ -324,13 +324,13 @@ var et2_dialog = et2_widget.extend({
{ {
this.div.dialog("option", "buttons", this._buttons[buttons]); this.div.dialog("option", "buttons", this._buttons[buttons]);
} }
else if (typeof buttons == "array") else if (buttons instanceof Array)
{ {
for (var i = 0; i < buttons.length; i++) for (var i = 0; i < buttons.length; i++)
{ {
if(!buttons[i].click) if(!buttons[i].click)
{ {
buttons[i].click = jQuery.proxy(this.click,this,buttons[i].id); buttons[i].click = jQuery.proxy(this.click,this,null,buttons[i].id);
} }
} }
this.options.buttons = buttons; this.options.buttons = buttons;
@ -388,6 +388,7 @@ var et2_dialog = et2_widget.extend({
this.set_message(this.options.message); this.set_message(this.options.message);
this.set_dialog_type(this.options.dialog_type); this.set_dialog_type(this.options.dialog_type);
} }
this.set_buttons(this.options.buttons);
this.div.dialog({ this.div.dialog({
// Pass the internal object, not the option // Pass the internal object, not the option
buttons: typeof this.options.buttons == "number" ? this._buttons[this.options.buttons] : this.options.buttons, buttons: typeof this.options.buttons == "number" ? this._buttons[this.options.buttons] : this.options.buttons,