Skip to content

Commit

Permalink
fix(table): invented a helper class to solve the styling logic when r…
Browse files Browse the repository at this point in the history
…owspan is used in tables

The styling is sometimes broken in the table element, when rowspan used. This confused later table rows which then usually have less columns.

As there is no way to look backward via CSS to find out if a previous column in a row was rowspanned and the table component is not a JS module, i invented a little helper class to solve this issue via pure html/css.

One just has to create a td node , where it is usually not necessary, and give it the new rowspanned class. This will just hide it from the screen but all existing table classes are working again, because the amount of td remains the same just like if there was no rowspan used at all.
  • Loading branch information
lubber-de authored Feb 24, 2020
1 parent 4deee38 commit 1b20446
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions src/definitions/collections/table.less
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@
transition: @transition;
}

/* Rowspan helper class */
.ui.table th.rowspanned,
.ui.table td.rowspanned {
display:none;
}

/* Headers */
.ui.table > thead {
box-shadow: @headerBoxShadow;
Expand Down Expand Up @@ -180,13 +186,13 @@
.ui.table:not(.unstackable) > tbody,
.ui.table:not(.unstackable) > tr,
.ui.table:not(.unstackable) > tbody > tr,
.ui.table:not(.unstackable) > tr > th,
.ui.table:not(.unstackable) > thead > tr > th,
.ui.table:not(.unstackable) > tbody > tr > th,
.ui.table:not(.unstackable) > tfoot > tr > th,
.ui.table:not(.unstackable) > tr > td,
.ui.table:not(.unstackable) > tbody > tr > td,
.ui.table:not(.unstackable) > tfoot > tr > td {
.ui.table:not(.unstackable) > tr > th:not(.rowspanned),
.ui.table:not(.unstackable) > thead > tr > th:not(.rowspanned),
.ui.table:not(.unstackable) > tbody > tr > th:not(.rowspanned),
.ui.table:not(.unstackable) > tfoot > tr > th:not(.rowspanned),
.ui.table:not(.unstackable) > tr > td:not(.rowspanned),
.ui.table:not(.unstackable) > tbody > tr > td:not(.rowspanned),
.ui.table:not(.unstackable) > tfoot > tr > td:not(.rowspanned) {
display: block !important;
width: auto !important;
}
Expand Down Expand Up @@ -469,13 +475,13 @@
.ui[class*="tablet stackable"].table > tbody,
.ui[class*="tablet stackable"].table > tbody > tr,
.ui[class*="tablet stackable"].table > tr,
.ui[class*="tablet stackable"].table > thead > tr > th,
.ui[class*="tablet stackable"].table > tbody > tr > th,
.ui[class*="tablet stackable"].table > tfoot > tr > th,
.ui[class*="tablet stackable"].table > tr > th,
.ui[class*="tablet stackable"].table > tbody > tr > td,
.ui[class*="tablet stackable"].table > tfoot > tr > td,
.ui[class*="tablet stackable"].table > tr > td {
.ui[class*="tablet stackable"].table > thead > tr > th:not(.rowspanned),
.ui[class*="tablet stackable"].table > tbody > tr > th:not(.rowspanned),
.ui[class*="tablet stackable"].table > tfoot > tr > th:not(.rowspanned),
.ui[class*="tablet stackable"].table > tr > th:not(.rowspanned),
.ui[class*="tablet stackable"].table > tbody > tr > td:not(.rowspanned),
.ui[class*="tablet stackable"].table > tfoot > tr > td:not(.rowspanned),
.ui[class*="tablet stackable"].table > tr > td:not(.rowspanned) {
display: block !important;
width: 100% !important;
}
Expand Down

0 comments on commit 1b20446

Please sign in to comment.