You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 24, 2019. It is now read-only.
First of all, I like your plugin very much, it's easy and simple. I wanted to tweak it a little bit so it updates the server-side data through ajax on change.
For that I made my .on("change") return a deferred object and changed your code to expect that.
Changed from:
if (evt.result === false) {
active.html(originalContent);
}
to:
jQuery.when(evt.result)
.done(function (result) {
if (result !== null && typeof result === 'object') {
//if it's an object
if (result.success) {
//if the property exist or has a truthy value
return true;
}
} else {
//it's a value or null
if (result) {
//if it has a truthy value
return true;
}
}
//it has a falsey value
active.html(originalContent);
})
.fail(function () {
active.html(originalContent);
});
The beauty of using ".when()" is that it keeps working if you return a not deferred object. For instance, false, so it doesn't break your current functionality, but I have a problem I don't know how to solve.
The originalContent attribute gets overwritten, so if I change a cell and quickly change another cell and both fail, the 2nd one will get the originalContent of the 1st one, and the 1st one will keep the new content.
Any idea about how to fix this? I think that if we manage to, this would be a great addition to your already excellent widget. :)
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
First of all, I like your plugin very much, it's easy and simple. I wanted to tweak it a little bit so it updates the server-side data through ajax on change.
For that I made my .on("change") return a deferred object and changed your code to expect that.
Changed from:
to:
The beauty of using ".when()" is that it keeps working if you return a not deferred object. For instance, false, so it doesn't break your current functionality, but I have a problem I don't know how to solve.
The originalContent attribute gets overwritten, so if I change a cell and quickly change another cell and both fail, the 2nd one will get the originalContent of the 1st one, and the 1st one will keep the new content.
Any idea about how to fix this? I think that if we manage to, this would be a great addition to your already excellent widget. :)
The text was updated successfully, but these errors were encountered: