-
-
Notifications
You must be signed in to change notification settings - Fork 627
update datatables.net-bs #3663
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
base: development
Are you sure you want to change the base?
update datatables.net-bs #3663
Conversation
f0d6269 to
48786ca
Compare
Go ahead and let's see how it looks. |
I don't think this is necessary, unless you find a real issue that requires a lot of changes (or if you prefer to do this way). |
|
Thanks for picking this up. I tried once (#2852) but it caused so much trouble that I reverted the changes. But if you want to address all the necessary changes I'm all in for it. |
I prefer the look of the old sorting indicator, but this might be only because I'm used to it. If the only way to go forward it to use the new icon then I'll probably need to re-adapt. |
Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
48786ca to
7459f13
Compare
I found it helpful to look at the diff in addition to the changelog, so I decided to leave it in. |
Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
7459f13 to
fcf6432
Compare
Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
|
I updated to 1.13.11 on this branch and changed it to use the default indicators for the high-contrast themes and LCARS |
| color: #eee; | ||
| } | ||
|
|
||
| .table-striped > tbody > tr:nth-of-type(2n + 1) { |
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.
The new CSS changed the selector here, so we need to changed it to make sure the table rows have alternating background colors:
| .table-striped > tbody > tr:nth-of-type(2n + 1) { | |
| table.dataTable.table-striped > tbody > tr:nth-of-type(2n + 1) { |
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.
What about using tr.odd instead of tr:nth-of-type(2n + 1)?
| .table-striped > tbody > tr:nth-of-type(2n + 1) { | |
| table.dataTable.table-striped > tbody > tr.odd { |
From the Domains page:
<tbody>
<tr
class="odd"
data-id="0064006f006d00610069006e0031002e0063006f006d_deny_exact"
></tr>
<tr
class="even"
data-id="0064006f006d00610069006e0032002e0063006f006d_deny_exact"
></tr>
<tr
class="odd"
data-id="0064006f006d00610069006e0033002e0063006f006d_deny_exact"
></tr>
<tr
class="even"
data-id="0064006f006d00610069006e0034002e0063006f006d_deny_exact"
></tr>
</tbody>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.
Both table.dataTable.table-striped > tbody > tr.odd and table.dataTable.table-striped > tbody > tr:nth-of-type(2n + 1) seem to work for Domains, Groups, Clients, Lists and Query Log.
But neither seems to work for the "homepage":
Example using Midnight:
This is with table.dataTable.table-striped > tbody > tr.odd and table.dataTable.table-striped > tbody > tr:nth-of-type(2n + 1):


The old .table-striped > tbody > tr:nth-of-type(2n + 1) is working for the homepage, but not something like Domains:


The table on the homepage does not have even and odd classes.
We would need something like this for default-dark.css:
.table-striped > tbody > tr:nth-of-type(2n + 1) {
background-color: #2d343a;
}
table.dataTable.table-striped > tbody > tr.odd {
background-color: #2d343a;
}The same is true for all other themes as well.
For LCARS:
| .table-striped > tbody > tr:nth-of-type(2n + 1) { | |
| table.dataTable.table-striped > tbody > tr.odd { | |
| background: none; | |
| background-color: rgba(80, 80, 80, 0.1); | |
| } | |
| .table-striped > tbody > tr:nth-of-type(2n + 1) { |
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.
For High contrast light we dont seem to need it at all.
With
.table-striped > tbody > tr:nth-of-type(2n + 1) {
background-color: #fcfcfc;
}
table.dataTable.table-striped > tbody > tr.odd {
background-color: #fcfcfc;
}
We might want to keep it, but use a color with better contrast instead, I will commit the Without changes for now.
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.
Hmmm...
I only used the group management pages for testing my suggestions.
Your suggestions will probably fix all issues, but I will take a look an check (using the last commit) why some tables are working differently, to make sure nothing else is broken.
| border: 1px solid #111 !important; | ||
| } | ||
|
|
||
| table.dataTable thead .sorting::before { |
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.
I agree most of the old CSS can be removed here, but I still think the default opacity is too low and the controls look too faded in this theme.
Can you please try these CSS rules?
table.dataTable thead > tr > th.sorting::before {
bottom: calc(50% + 2px);
opacity: 0.2;
}
table.dataTable thead > tr > th.sorting::after {
opacity: 0.2;
}
table.dataTable thead > tr > th.sorting.sorting_asc::before {
opacity: 1;
}
table.dataTable thead > tr > th.sorting.sorting_desc::after {
opacity: 1;
}
| background-color: rgba(0, 64, 64, 0.35); | ||
| } | ||
|
|
||
| table.dataTable thead .sorting::after, |
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.
We need to try co increase the contrast on these 2 themes
Can you try this for the dark theme?
table.dataTable thead > tr > th.sorting::before {
opacity: 0.4;
}
table.dataTable thead > tr > th.sorting::after {
opacity: 0.4;
}
table.dataTable thead > tr > th.sorting:hover::before,
table.dataTable thead > tr > th.sorting:hover::after {
color: var(--primary-color);
}
table.dataTable thead > tr > th.sorting.sorting_asc::before,
table.dataTable thead > tr > th.sorting.sorting_desc::after {
opacity: 1;
color: #fff;
}
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.
[deleted](Commented on the wrong suggestion)
| background-color: rgba(255, 204, 0, 0.333); | ||
| } | ||
|
|
||
| table.dataTable thead .sorting:after, |
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.
And this for the light theme?
table.dataTable thead > tr > th.sorting::before {
opacity: 0.5;
}
table.dataTable thead > tr > th.sorting::after {
opacity: 0.5;
}
table.dataTable thead > tr > th.sorting:hover::before,
table.dataTable thead > tr > th.sorting:hover::after {
color: var(--primary-color);
}
table.dataTable thead > tr > th.sorting.sorting_asc::before,
table.dataTable thead > tr > th.sorting.sorting_desc::after {
opacity: 1;
color: #fff;
}
Co-authored-by: RD WebDesign <github@rdwebdesign.com.br> Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
yubiuser
left a comment
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.
I just checked the visuals on all themes briefly and they look fine.
I would consider this PR ready for review?
|
Originally I considered updating datatables-buttons and datatables-select as well, but I experimented a bit and wouldn't include them here. I think this PR could be ready for review now. |
yubiuser
left a comment
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.
When selecting a row the background of the row turns blue, regardless of the theme. Before, the background changed accordingly to the theme and was never that 'intrusive'. Is this by design?
|
Side question: is there any (technical) reason not to upgrade to the v2 version of data tables? |
I don't think so. EDIT: There are CSS differences. The old plugin version used a background color on the selected table.dataTable tbody > tr.selected,
table.dataTable tbody > tr > .selected {
background-color:#B0BED9
}And we have our own rule on Now, the new version applies a table.dataTable > tbody > tr.selected > * {
box-shadow:inset 0 0 0 9999px rgb(0, 136, 204);
box-shadow:inset 0 0 0 9999px rgb(var(--dt-row-selected));
color:rgb(255, 255, 255);
color:rgb(var(--dt-row-selected-text))
}The background color is not changed, but the text color is changed. Apparently there are many small CSS changes and we will need to adapt our themes. |
The changes are from the stylesheet modernization in datatables 1.12.0 . From https://datatables.net/blog/2022/datatables-1.12#Row-colouring-improvements:
Datatables now provides CSS variables for changing the color of cells: :root {
--dt-row-selected: 0, 136, 204;
--dt-row-selected-text: 255, 255, 255;
--dt-row-selected-link: 9, 10, 11;
--dt-row-stripe: 0, 0, 0;
--dt-row-hover: 0, 0, 0;
--dt-column-ordering: 0, 0, 0;
--dt-html-background: white;
}I will try using the new CSS variables for changing the cell color whenever possible. |
|
The issue is not just about the new datatables CSS, but how they interact with the AdminLTE v2.4 CSS and the changes made on top of that ( We will probably need to tweak the alpha channel for the EDIT: I'm not able to test it right now, but reading the CSS, I think we can restore the previous behavior adding this to table.dataTable tbody > tr.selected > *,
table.dataTable tbody > tr > .selected > * {
box-shadow: none;
} |


My commits are currently not DCO signed, since I will squash to fewer commits later.I found out how to amend the DCO to multiple commitsWhat does this PR aim to accomplish?:
Update
datatables.net-bs, currently1.10.21to1.11.5, possibly to the latest 1.x (1.13.11)How does this PR accomplish the above?:
All files are from
https://cdn.datatables.net/v/bs/dt-VERSION/datatables{,.min}.{js,css}I have added the source files and made an individual commit for each version so reviewers can quickly see what changed in the update. The source files will be force-pushed away later.
Changelogs are found at: https://cdn.datatables.net/VERSION/, like https://cdn.datatables.net/1.10.21/ , but not all changes apply to our Bootstrap 3 version
1.10.24(e580e76) requires a CSS change for LCARS and the high-contrast themes (they are the only ones that style the default sorting indicator).In addition to the
soriting_asc/sorting_descis now thesortingclass applied. See DataTables/DataTablesSrc@a9ccfb4#r49603378My fix in f33ccd4 makes it look the same as
development/master.What LCARS would look like without the fix:
With the fix /
development:Updating to


1.12.0and later would require additional changes to the sorting indicators, since it changed the default sorting indicator.Midnight on
1.11.5and below (so also currentdevelopment):Midnight after
1.12.0:Changelog for 1.12.0: https://cdn.datatables.net/1.12.0/
A diff can be found on another branch of mine: darkexplosiveqwx@ea72658
Should I update to


1.12.0and later and just remove all the custom CSS for the sorting indicator?Here is what it would look like for LCARS and High-contrast dark:
My other branch https://github.com/darkexplosiveqwx/pi-hole-web/tree/datatables-misc is updated to
1.13.11and uses the new default sorting indicatorsBy submitting this pull request, I confirm the following:
git rebase)