diff --git a/src/assets/ModalRemote.js b/src/assets/ModalRemote.js index 0b7b616..0c593a9 100644 --- a/src/assets/ModalRemote.js +++ b/src/assets/ModalRemote.js @@ -162,13 +162,13 @@ function ModalRemote(modalId) { * @param {string} method The method of request * @param {object}data of request */ - this.doRemote = function (url, method, data) { + this.doRemote = function (url, method, data, isAsync = false) { var instance = this; $.ajax({ url: url, method: method, data: data, - async: false, + async: isAsync, beforeSend: function () { beforeRemoteRequest.call(instance); }, @@ -294,7 +294,7 @@ function ModalRemote(modalId) { * @param {string} dataRequestMethod POST or GET * @param {number[]} selectedIds */ - this.confirmModal = function (title, message, okLabel, cancelLabel, size, dataUrl, dataRequestMethod, selectedIds) { + this.confirmModal = function (title, message, okLabel, cancelLabel, size, dataUrl, dataRequestMethod, selectedIds, isAsync) { this.show(); this.setSize(size); @@ -329,7 +329,8 @@ function ModalRemote(modalId) { instance.doRemote( dataUrl, dataRequestMethod, - data + data, + isAsync ); } ); @@ -378,13 +379,15 @@ function ModalRemote(modalId) { $(elm).hasAttr('data-modal-size') ? $(elm).attr('data-modal-size') : 'normal', $(elm).hasAttr('href') ? $(elm).attr('href') : $(elm).attr('data-url'), $(elm).hasAttr('data-request-method') ? $(elm).attr('data-request-method') : 'GET', - bulkData + bulkData, + $(elm).hasAttr('data-request-async') ? $(elm).attr('data-request-async') !== 'false' : null ) } else { this.doRemote( $(elm).hasAttr('href') ? $(elm).attr('href') : $(elm).attr('data-url'), $(elm).hasAttr('data-request-method') ? $(elm).attr('data-request-method') : 'GET', - bulkData + bulkData, + $(elm).hasAttr('data-request-async') ? $(elm).attr('data-request-async') !== 'false' : null ); } } diff --git a/src/assets/ModalRemote.min.js b/src/assets/ModalRemote.min.js old mode 100644 new mode 100755 index 1acddb2..a279b0c --- a/src/assets/ModalRemote.min.js +++ b/src/assets/ModalRemote.min.js @@ -1 +1 @@ -function ModalRemote(t){function o(){this.show(),this.displayLoading()}function e(t){this.setTitle(t.status+t.statusText),this.setContent(t.responseText),this.addFooterButton("Close","button","btn btn-default",function(t,o){this.hide()})}function i(t){return void 0!==t.forceReload&&t.forceReload&&("true"==t.forceReload?$.pjax.reload({container:"#crud-datatable-pjax"}):$.pjax.reload({container:t.forceReload})),void 0!==t.forceClose&&t.forceClose?void this.hide():(void 0!==t.size&&this.setSize(t.size),void 0!==t.title&&this.setTitle(t.title),void 0!==t.content&&this.setContent(t.content),void 0!==t.footer&&this.setFooter(t.footer),void(void 0!==$(this.content).find("form")[0]&&this.setupFormSubmit($(this.content).find("form")[0],$(this.footer).find('[type="submit"]')[0])))}this.defaults={okLabel:"OK",executeLabel:"Execute",cancelLabel:"Cancel",loadingTitle:"Loading"},this.modal=$(t),this.dialog=$(t).find(".modal-dialog"),this.header=$(t).find(".modal-header"),this.content=$(t).find(".modal-body"),this.footer=$(t).find(".modal-footer"),this.loadingContent='