-1

Could somebody tell me how shold I approach binding the text property of a column header in a TableView to another property, that can be changed with a combobox selection?

I tried column.textProperty().bind(myProperty) , but the column header doesn't refresh the text when myProperty changes. It only happens after I click on the column header as if I wanted to sort the column. Is there any way to make it refresh automatically when changed ? Or does anybody have other suggestions how to approach this ?

Near
  • 391
  • 4
  • 16
  • Can you post an example where this doesn't work? (See http://stackoverflow.com/help/mcve). I tested and it worked as expected. – James_D May 15 '15 at 17:35
  • I'm sorry I don't have much time right now to make a MCVE, I was hoping it wouldn't be needed. Could you maybe show your example so I can take a look and maybe see a mistake I made ? – Near May 15 '15 at 17:38
  • I just did the obvious 2-minute example, and it worked. [See here](https://gist.github.com/james-d/147ce9c04af215788e9a) – James_D May 15 '15 at 17:39
  • I really can't think of a way how to make an example out of my fxml controller right now. But the problem's not in the binding , I tried converting the columns from local variables to fields, and then calling `column.setText("text")` in `setOnAction()` of the combo box , and it does the same thing. – Near May 15 '15 at 17:46
  • It's hard to see how you expect anyone to be able to answer this without an MCVE. – James_D May 15 '15 at 17:51
  • I'm a beginner at this , and I thought I could have messed up something in the basics, so I gave it a shot. I guess I'll have to figure this out on my own . Thanks and sorry for bothering you – Near May 15 '15 at 17:59

1 Answers1

0

Found out it was because I've accidentally put the method that changes the property into a block that runs in a separate thread.

Near
  • 391
  • 4
  • 16