mirror of
https://github.com/NaN-tic/sao-base.git
synced 2023-12-14 03:13:01 +01:00
Disable button during click processing
The click event must be blocked when the screen method is called to limit double execution. A double execution is still possible if the execution of the action, which is asynchronous, is not started fast enough. issue5362 review17881002
This commit is contained in:
parent
35232f7d2b
commit
3a705ad3a5
|
@ -361,7 +361,12 @@
|
|||
},
|
||||
button_clicked: function(event) {
|
||||
var button = event.data;
|
||||
this.screen.button(button.attributes);
|
||||
button.el.prop('disabled', true);
|
||||
try {
|
||||
this.screen.button(button.attributes);
|
||||
} finally {
|
||||
button.el.prop('disabled', false);
|
||||
}
|
||||
},
|
||||
selected_records: function() {
|
||||
if (this.screen.current_record) {
|
||||
|
|
|
@ -1512,7 +1512,7 @@
|
|||
},
|
||||
render: function(record) {
|
||||
var button = new Sao.common.Button(this.attributes);
|
||||
button.el.click(record, this.button_clicked.bind(this));
|
||||
button.el.click([record, button], this.button_clicked.bind(this));
|
||||
var fields = jQuery.map(this.screen.model.fields,
|
||||
function(field, name) {
|
||||
if ((field.description.loading || 'eager') ==
|
||||
|
@ -1529,7 +1529,8 @@
|
|||
return button.el;
|
||||
},
|
||||
button_clicked: function(event) {
|
||||
var record = event.data;
|
||||
var record = event.data[0];
|
||||
var button = event.data[1];
|
||||
if (record != this.screen.current_record) {
|
||||
return;
|
||||
}
|
||||
|
@ -1537,7 +1538,12 @@
|
|||
if (states.invisible || states.readonly) {
|
||||
return;
|
||||
}
|
||||
this.screen.button(this.attributes);
|
||||
button.el.prop('disabled', true);
|
||||
try {
|
||||
this.screen.button(this.attributes);
|
||||
} finally {
|
||||
button.el.prop('disabled', false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue