Skip to content
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

If you use multiple loadings, message does not change #4

Closed
morzius opened this issue Jun 3, 2015 · 4 comments
Closed

If you use multiple loadings, message does not change #4

morzius opened this issue Jun 3, 2015 · 4 comments

Comments

@morzius
Copy link

morzius commented Jun 3, 2015

I got 2 buttons with ajax on them,

first one
...
beforeSend: function () {
$('body').loading({
stoppable: false,
message: 'Unpublish...'
});
},
...

second one
...
beforeSend: function () {
$('body').loading({
stoppable: false,
message: 'Publish...'
});
},
...

if i click "publish", then another button will have same message and vice versa

@CarlosBonetti
Copy link
Owner

Hi @morzius, thanks for the feedback!

That's a scenario I didn't consider when developing this plugin.

For now, the plugin uses the first call to create the plugin object and store it in the associated DOM (in your case, the body). The subsequent calls use the previously defined overlay and just start it.

For now, you can temporarily fix your problem doing:

$('body').removeData('jquery-loading');
$('body').loading({
...
});

This will remove the previously defined overlay and start it all again.

I will be working on a permanent solution and posting the feedback here. Let me know if you have another problem.

@morzius
Copy link
Author

morzius commented Jun 3, 2015

Thank you,
I did something similar

$('body').loading({ 
...
});
$(".loading-overlay-content").text('...');

@tompazourek
Copy link

I solved it using this:

$.Loading.setDefaults({
  onStop: function (loading) {
    $(loading.element).removeData('jquery-loading');
  }
});

@CarlosBonetti
Copy link
Owner

@morzius, @tompazourek. I just fixed the problem on release 1.1.0.

Now subsequent calls to the plugin will override config options.

Please, let me know if you find any problems. Thanks for the feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants