-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.0] Improving row selection in Joomla! Admin #14913
Changes from 3 commits
693f214
c99ed9a
e5d9dc9
e4775b1
12b8cea
dff3f62
0a5a387
ac8c87d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,3 +46,48 @@ Joomla.JMultiSelect = function(table) { | |
}; | ||
initialize(table); | ||
}; | ||
|
||
document.addEventListener("DOMContentLoaded", function(event) { | ||
color = '#d9edf7'; | ||
rows = document.querySelectorAll('tr[class^="row"]'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. change to:
Note, the British spelling of |
||
|
||
// Changes the background-color on every <td> inside a <tr> | ||
function changeBg(item, color) { | ||
item.querySelectorAll('td').forEach (function(td) { | ||
td.style.backgroundColor = color; | ||
}); | ||
} | ||
|
||
document.getElementsByName("checkall-toggle")[0].addEventListener("click", function(event) { | ||
if (this.checked) { | ||
rows.forEach(function(row, index) { | ||
changeBg(row, color); | ||
}); | ||
} | ||
else { | ||
rows.forEach(function(row, index) { | ||
changeBg(row, ''); | ||
}); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can simplify this
|
||
}); | ||
|
||
rows.forEach(function(row, index) { | ||
row.addEventListener("click", function(event) { | ||
clicked = 'cb' + index; | ||
cbClicked = document.getElementById(clicked); | ||
|
||
if (!(event.target.id == clicked)) { | ||
cbClicked.checked = !cbClicked.checked; | ||
Joomla.isChecked(cbClicked.checked); | ||
} | ||
|
||
if (cbClicked.checked) { | ||
changeBg(this, color); | ||
} | ||
else { | ||
changeBg(this, ''); | ||
} | ||
}); | ||
}); | ||
}); | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a colon after the variable name, like so:
$table-row-selected: