Fixes behavior of the 'check-all' checkbox
in tables. Currently the on('click') delegate is being invoked several times from the wrong place, thus allowing another on('click') delegate to be executed before this one, which changes the expected behavior. Fixes bug 1019088 Change-Id: Iba2b3549090f7bd42fc8b029ed42163951cb9e22
This commit is contained in:
parent
df106572cc
commit
0ae25565ca
@ -115,19 +115,6 @@ horizon.datatables = {
|
||||
$(this).find(".table_actions button.btn-danger").addClass("disabled");
|
||||
}
|
||||
});
|
||||
|
||||
$("div.table_wrapper, div.modal_wrapper").on("click", ':checkbox', function (evt) {
|
||||
var $form = $(this).closest("form");
|
||||
var any_checked = $form.find("tbody :checkbox").is(":checked");
|
||||
|
||||
// Enable the button if any checkbox is checked,
|
||||
// Disable if all checkbox is cleared
|
||||
if(any_checked) {
|
||||
$form.find(".table_actions button.btn-danger").removeClass("disabled");
|
||||
}else {
|
||||
$form.find(".table_actions button.btn-danger").addClass("disabled");
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@ -223,6 +210,18 @@ horizon.addInitFunction(function() {
|
||||
checkboxes.prop('checked', is_checked);
|
||||
});
|
||||
|
||||
$("div.table_wrapper, div.modal_wrapper").on("click", ':checkbox', function (evt) {
|
||||
var $form = $(this).closest("form");
|
||||
var any_checked = $form.find("tbody :checkbox").is(":checked");
|
||||
// Enable the button if any checkbox is checked,
|
||||
// Disable if all checkbox is cleared
|
||||
if(any_checked) {
|
||||
$form.find(".table_actions button.btn-danger").removeClass("disabled");
|
||||
}else {
|
||||
$form.find(".table_actions button.btn-danger").addClass("disabled");
|
||||
}
|
||||
});
|
||||
|
||||
horizon.datatables.add_table_checkboxes($('body'));
|
||||
horizon.datatables.set_table_sorting($('body'));
|
||||
horizon.datatables.set_table_filter($('body'));
|
||||
|
Loading…
x
Reference in New Issue
Block a user