Skip to content

Commit

Permalink
Add new API: $( ".selector" ).dialog( "option", "buttons", {});
Browse files Browse the repository at this point in the history
  • Loading branch information
newghost committed Jul 18, 2014
1 parent 7964caa commit c000122
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
21 changes: 19 additions & 2 deletions home.html
Expand Up @@ -264,6 +264,25 @@ <h3>onClose</h3>
$(this).dialog("destroy");
}
});</pre>

<h3>option buttons</h3>
<hr>
<p>
Redefine the buttons
<a class="btn btn-success" onclick="run('#preChangeButton')">Run</a>
</p>
<pre id="preChangeButton" class="prettyprint linenums">
$( "#loginwrap" ).dialog(
"option"
, "buttons"
, [{
text: "Ok"
, click: function() {
$( this ).dialog( "close" );
}
}]
);
</pre>
</div>

<div class="col-lg-6">
Expand Down Expand Up @@ -307,7 +326,6 @@ <h3>buttons: Array</h3>
]
});
</pre>
<pre id="preButtonDialog_result"></pre>

<h3>buttons: Object</h3>
<hr>
Expand All @@ -332,7 +350,6 @@ <h3>buttons: Object</h3>
}
});
</pre>
<pre id="preButtonDialogObject_result"></pre>
</div>

</div>
Expand Down
9 changes: 7 additions & 2 deletions js/jquery.bootstrap.js
Expand Up @@ -59,8 +59,8 @@ require:
$msgbox.find(".modal-body").append($this);
};

var createButton = function() {
var buttons = options.buttons || {}
var createButton = function(_options) {
var buttons = (_options || options || {}).buttons || {}
, $btnrow = $msgbox.find(".modal-footer");

//clear old buttons
Expand Down Expand Up @@ -144,6 +144,11 @@ require:
show();
}

if (options == "option") {
arguments[1] == 'buttons' && createButton({ buttons: arguments[2] });
show();
}

return self;
};

Expand Down
2 changes: 1 addition & 1 deletion js/jquery.bootstrap.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions src/jquery.dialog.js
Expand Up @@ -39,8 +39,8 @@ require:
$msgbox.find(".modal-body").append($this);
};

var createButton = function() {
var buttons = options.buttons || {}
var createButton = function(_options) {
var buttons = (_options || options || {}).buttons || {}
, $btnrow = $msgbox.find(".modal-footer");

//clear old buttons
Expand Down Expand Up @@ -124,6 +124,11 @@ require:
show();
}

if (options == "option") {
arguments[1] == 'buttons' && createButton({ buttons: arguments[2] });
show();
}

return self;
};

Expand Down

0 comments on commit c000122

Please sign in to comment.