André
André

Reputation: 49

How to hide the header of a tableview in TornadoFX?

Is there a tornadofx-way to hide the header row of a tableview? How do I do that?

Thanks. :-)

I tried finding a header property of some kind in tableview but there is none. Do I have to do it via css/style?

Upvotes: 0

Views: 100

Answers (1)

Edvin Syse
Edvin Syse

Reputation: 7297

There isn't a TornadoFX specific function that does that, but you can create a stylesheet, or even an inline stylesheet inside the TableView definition to take care of it:

stylesheet {
    Stylesheet.columnHeaderBackground {
        maxHeight = 0.px
        prefHeight = 0.px
        minHeight = 0.px
    }
}

Written in an external type safe stylesheet that would look like:

class Styles : Stylesheet() {
    companion object {
        val tableNoHeader by cssclass()
    }

    init {
        tableNoHeader {
            maxHeight = 0.px
            prefHeight = 0.px
            minHeight = 0.px
        }
    }
}

Now you just need to add the Styles.tableNoHeader css class to your TableView.

Oh, and remember to add the stylesheet to your App constructor :)

Upvotes: 1

Related Questions