SearchableComboBox updated options from API

31 views
Skip to first unread message

Josef Petrák

unread,
Mar 1, 2021, 9:11:38 PM3/1/21
to ControlsFX
Hello,

I would like to use SearchableComboBox to select Stations. When user clicks to editable text field, default Stations are loaded from API and provided as options, when starts typing, options are auto-updated from API based on inserted query. I am wondering, how to obtain current content of the text field so I can pass it to API...

Controller has the fields defined from FXML

@FXML
private SearchableComboBox<String> selectPlaceFrom;

The box has ID, and following actions mapped:

<SearchableComboBox
fx:id="selectPlaceFrom"
maxWidth="Infinity"
editable="true"
onMouseEntered="#onSelectPlaceFromClicked"
onKeyReleased="#onSelectPlaceFromChanged"
/>

In those actions, I have tried following to get the current text field value:

selectPlaceFrom.getValue()
selectPlaceFrom.getEditor().getText()
selectPlaceFrom.getEditor().textProperty().getValue()

None provided the textual value for place query. The example does not cover this as well.

Thanks

Josef Petrak
Reply all
Reply to author
Forward
0 new messages