proper disabled states for select all and delete btns

delete row(s) button is no longer enabled when 'select all' rows is checked, while there are no rows.

'select all' is now disabled when there are no rows.
This commit is contained in:
Corban-Lee Jones 2024-04-26 11:47:55 +01:00
parent 726b8f8c3f
commit da5e76278b

View File

@ -90,7 +90,7 @@ function determineSelectAllState() {
selectAllCheckbox.prop("checked", checked);
selectAllCheckbox.prop("indeterminate", indeterminate);
$("#tableDeleteSelectedBtn").prop("disabled", !(checked || indeterminate));
$("#tableDeleteSelectedBtn").prop("disabled", !(checked || indeterminate) || !(allRowsCount > 0));
}
// Select a row via checkbox
@ -204,6 +204,7 @@ async function loadSubscriptions(guildId) {
try {
const subscriptions = await getSubscriptions(guildId);
subTable.rows.add(subscriptions.results).draw(false);
$("#subTable thead .table-select-all").prop("disabled", subscriptions.results.length === 0);
}
catch (err) {
console.error(JSON.stringify(error, null, 4));