How to apply a function to a tableview column? I t...
# tornadofx
u
How to apply a function to a tableview column? I tried using extension function/property but wasn't picked up.
a
You need to clarify what do you mean by "apply a function". You want to operate on data or what?
u
Yep I don't have access to the class since it's third party but I want to use a few fields in the object to return a double
Something like this (doesn't have to be extension of course)
Copy code
column("Full name", User::fullName)
Copy code
fun User.fullName(): String = "$firstName $lastName"
a
You need to operate whatever data you've fed to the table, not the columns. If you need a custom column, I believer there is one in documentation.
u
Thanks managed to find one using valueProvider 👍