Skip to content

Add Option to pass pjax url #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/assets/ModalRemote.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function ModalRemote(modalId) {

this.footer = $(modalId).find('.modal-footer');

this.loadingContent = '<div class="progress progress-striped active" style="margin-bottom:0;"><div class="progress-bar" style="width: 100%"></div></div>';
this.loadingContent = '<div class="progress" style="margin-bottom:0;"><div class="progress-bar progress-bar-striped progress-bar-animated" style="width: 100%"></div></div>';


/**
Expand Down Expand Up @@ -69,10 +69,13 @@ function ModalRemote(modalId) {
* @param {string} size large/normal/small
*/
this.setSize = function (size) {
$(this.dialog).removeClass('modal-xl');
$(this.dialog).removeClass('modal-lg');
$(this.dialog).removeClass('modal-sm');
if (size == 'large')
$(this.dialog).addClass('modal-lg');
else if (size == 'xlarge')
$(this.dialog).addClass('modal-xl');
else if (size == 'small')
$(this.dialog).addClass('modal-sm');
else if (size !== 'normal')
Expand Down Expand Up @@ -169,7 +172,6 @@ function ModalRemote(modalId) {
url: url,
method: method,
data: data,
async: false,
beforeSend: function () {
beforeRemoteRequest.call(instance);
},
Expand Down Expand Up @@ -218,12 +220,20 @@ function ModalRemote(modalId) {
if ($(response.forceReload).length > 0){
// Reload datatable if response contain forceReload field
if (response.forceReload !== undefined && response.forceReload) {
let options = {};
if (response.forceReload == 'true') {
// Backwards compatible reload of fixed crud-datatable-pjax
$.pjax.reload({container: '#crud-datatable-pjax'});
options['container'] = '#crud-datatable-pjax';
} else {
$.pjax.reload({container: response.forceReload});
options['container'] = response.forceReload;
}

// Check if pjax url exist
if (response.forceReloadUrl !== undefined && response.forceReloadUrl) {
options['url'] = response.forceReloadUrl;
}

$.pjax.reload(options);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/assets/ModalRemote.min.js

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