In a table view with output from a result set 10 r...
# tornadofx
m
In a table view with output from a result set 10 rows, how to make the empty rows disappear?
like this I mean
m
try
tableView.refresh()
however, it should automatically handle that if your table is bound to observable objects
m
It is a fresh load that looks like the initial screen I posted. It is a dynamically populated table and there is no observable logic anywhere in my script and as I am yet to get in to that territory.
m
yeah so looks like this is just the way table view works
in order to get what you want I think you would have to place a tableview in a scroll pane
and the size change based on the content
m
will try and get back.
m
before you do that, take a look at row factory
m
will do.
m
I use `ListView`s in a few places. I also get alternating background past the actual rows. I assumed it was a "feature" of JavaFX.
a
This can be done with CSS, if you take a look on your layout using "Layout Debugger" you will find empty rows added by JavaFX.
m
@Adel Tahri Could you give me more directions please.
m
@melatonina I will try to enclose the table view within list view and let you know.
m
This is the CSS fix for ListView:
Copy code
listCell {
    and(empty) {
        backgroundColor += Color.TRANSPARENT
        and(odd) {
            backgroundColor += Color.TRANSPARENT
        }
    }
}
A similar stylesheet will fix the table view.
m
Thanks @melatonina and @Marshall!!!