Use the empty
pseudo class (see Cell
CSS reference) to set the background color of those rows from css:
E.g.
.table-row-cell:empty {
-fx-background-color: transparent;
}
In case you use CSS to style odd/even cells yourself, you can simply add the :filled
pseudoclass to all those selectors to only make them applicable to non-empty cells (assuming those selectors are for Cell
s only). E.g.:
.table-row-cell:empty {
-fx-background-color: transparent;
}
.table-row-cell:odd:filled {
-fx-background-color: red;
}
.table-row-cell:even:filled {
-fx-background-color: lightblue;
}
Or simply use more concrete selectors by using the selectors applying to table rows plus the :empty
selector:
.table-row-cell:empty:odd, .table-row-cell:empty:even {
-fx-background-color: transparent;
}
.table-row-cell:odd {
-fx-background-color: red;
}
.table-row-cell:even {
-fx-background-color: lightblue;
}