1

My table contains a ComboBoxTableCell with setComboBoxEditable(true). I need to obtain the text typed into the editor of the combo box.

A regular ComboBox contains getEditor().getText() method to achieve this. But how can I achieve this in ComboBoxTableCell since it's lacking getEditor()?

user2914191
  • 877
  • 1
  • 8
  • 21
  • Just a guess here, but it seems like there is a `setOnEditCommit` event handler that you can use. See [this](https://stackoverflow.com/questions/21860019/javafx-create-combobox-tablecell) example. – SedJ601 Sep 30 '17 at 18:15
  • i am working on auto-complete filtering. i need to get text as it's typed, not when it's committed – user2914191 Sep 30 '17 at 18:16
  • Well, you talked about `getText()` which doesn't get content as it is typed. That's why I suggested what I suggested. – SedJ601 Sep 30 '17 at 18:18
  • `setOnEditCommit` fires when you press enter. i need to filter results before pressing enter or clicking away – user2914191 Sep 30 '17 at 18:19
  • This could be duplicate - https://stackoverflow.com/questions/32885092/how-to-get-values-selected-in-comboboxtablecell-in-table-view – fabfas Sep 30 '17 at 18:23
  • Sounds like he wants an `onKeyleased` or some binding situation. – SedJ601 Sep 30 '17 at 18:27
  • no its not a duplicate. i dont need `setOnEditCommit`. its not what im looking for. i need to get typed text of the combobox. i could use `setOnKeyReleased` to build a string based on each character typed, but thats not elegant – user2914191 Sep 30 '17 at 18:36
  • what's the problem with getting the textfield of the editable combo? grab it and either listen to its textProperty or use a textFormatter – kleopatra Sep 30 '17 at 20:03
  • how do i get the textfield of the editable combo if i dont have access to the combo object? – user2914191 Oct 01 '17 at 04:05
  • subclass and grab the cell's graphic (that's the combo) in the very first startEdit – kleopatra Oct 01 '17 at 08:35
  • yeah i ended up creating a custom `TableCell` with a `ComboBox` – user2914191 Oct 03 '17 at 13:18

0 Answers0