Merge an old stash allowing passing an alternate buttonconfig parameter to show/get Modal
This commit is contained in:
parent
cb58b70078
commit
6d9c582e13
|
@ -781,7 +781,7 @@ function logAjaxFail(jqxhr, textStatus, error) {
|
|||
}
|
||||
|
||||
// Load the Modal HTML via Ajax call
|
||||
function getModal(id, parameters) {
|
||||
function getModal(id, parameters, buttonconfig=null) {
|
||||
$j.getJSON(thisUrl + '?request=modal&modal='+id+'&'+parameters)
|
||||
.done(function(data) {
|
||||
if ( !data ) {
|
||||
|
@ -790,7 +790,7 @@ function getModal(id, parameters) {
|
|||
}
|
||||
|
||||
insertModalHtml(id, data.html);
|
||||
manageModalBtns(id);
|
||||
buttonconfig ? buttonconfig() : manageModalBtns(id);
|
||||
modal = $j('#'+id+'Modal');
|
||||
if ( ! modal.length ) {
|
||||
console.log('No modal found');
|
||||
|
@ -800,6 +800,14 @@ function getModal(id, parameters) {
|
|||
.fail(logAjaxFail);
|
||||
}
|
||||
|
||||
function showModal(id, buttonconfig=null) {
|
||||
var div = $j('#'+id+'Modal');
|
||||
if ( ! div.length ) {
|
||||
getModal(id, buttonconfig);
|
||||
}
|
||||
div.modal('show');
|
||||
}
|
||||
|
||||
function manageModalBtns(id) {
|
||||
// Manage the CANCEL modal button, note data-dismiss="modal" would work better
|
||||
var cancelBtn = document.getElementById(id+"CancelBtn");
|
||||
|
|
Loading…
Reference in New Issue