Closed thomasnield closed 7 years ago
Hmmm... dang it. This could be problematic on initial construction. The createFilter()
would have to be called last unless I put in a fix to account for new columns being added. The column()
block might not work with TableFilter
manipulation either, as the TableFilter
would not be initialized yet. This undertaking might take a bit longer. I'll probably stick with my Java factory for now and focus on simpler controls until I make some tweaks to TableFilter
in ControlsFX.
I haven't completely understood how the TableFilter works yet (haven't tried it or looked at the source code yet) but could you store the instance as a property on the TableView? I use that trick sometimes. Also, you can listen for new columns being added, since the columns
property is an ObservableList
. Does that help?
How do you physically add a new property on a type you don't own? Do you just use extension properties but store the instance elsewhere?
Also yes the column listeners need to be added. I still have a few things I need to do with the TableFilter, and that would fix the problem.
Every Node
has a Map
called properties
where you can add arbitrary data:
TableView<String>().apply {
properties["tornadofx.customValue"] = "Hello world"
}
Oh wow, I did not know such sorcery existed. Perfect!
Haha :) I use it a lot in my apps as well to keep state. I've also put a property map directly on View by the way!
That is very good to know... I think I saw it once and it slightly puzzled me. But now I am aware if its needed. Properties[] all the things!!!
I'm going to look at implementing the
TableFilter
since I use it daily, as well as some simpler controls that aren't as difficult.A problem is the
TableFilter
is not stored onto theTableView
since theTableView
has no such property to hold it.I suppose we can create a map somewhere that maintains an associating between a
TableFilter
and theTableView
it is applied on. That way we can create extension functions onTableView
andTableColumn
.Sorry if this is somewhat involved from an API planning standpoint. Let's take our time on this and keep it on low priority with everything else going on.