DataTables: disable action buttons even if there are no checkboxes
Even if there are no checkboxes, we should disable action buttons instead of just doing nothing. Closes-bug: #1263673 Change-Id: Ib20504162e7ffb54c6f6427b364276b13857af3b
This commit is contained in:
parent
58feb1a0fd
commit
d860d9dcaa
|
@ -113,13 +113,11 @@ horizon.datatables = {
|
|||
// Disable form button if checkbox are not checked
|
||||
$("form").each(function (i) {
|
||||
var checkboxes = $(this).find(".table-row-multi-select:checkbox");
|
||||
if(!checkboxes.length) {
|
||||
// Do nothing if no checkboxes in this form
|
||||
return;
|
||||
}
|
||||
if(!checkboxes.filter(":checked").length) {
|
||||
$(this).find(".table_actions button.btn-danger").addClass("disabled");
|
||||
}
|
||||
var action_buttons = $(this).find(".table_actions button.btn-danger");
|
||||
|
||||
// Buttons should be enabled only if there are checked checkboxes
|
||||
action_buttons.toggleClass("disabled",
|
||||
!checkboxes.filter(":checked").length);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue