Use data instead of disabled prop when clicking on button

The action may actually disable the button.
This commit is contained in:
Cédric Krier committed 2022-03-26 12:59:43 +01:00
1 parent 88bdd712cc
commit a6e1420b2a
1 file changed
+8 -2
+8 -2
View File
@@ -253,10 +253,16 @@
this.buttons[item.id].click(item, function(event) {
var item = event.data;
var button = this.buttons[item.id];
button.prop('disabled', true);
// Use data instead of disabled prop because the action may
// actually disable the button.
if (button.data('disabled')) {
event.preventDefault();
return;
}
button.data('disabled', true);
(this[item.id](this) || jQuery.when())
.always(function() {
button.prop('disabled', false);
button.data('disabled', false);
});
}.bind(this));
};