Execute search when user changes search mode

This commit is contained in:
Marvin Elsen 2024-09-20 20:23:05 +02:00
parent 239d0d7da2
commit 573515217e
Signed by: marvinelsen
GPG Key ID: 820672408CC318C2

View File

@ -24,5 +24,14 @@ class SearchController(private val model: Model) {
val searchMode = searchModeToggleGroup.selectedToggle.userData as SearchMode val searchMode = searchModeToggleGroup.selectedToggle.userData as SearchMode
model.search(newValue, searchMode) model.search(newValue, searchMode)
} }
searchModeToggleGroup.selectedToggleProperty().addListener { _, _, newValue ->
if (textFieldSearch.text.isNullOrBlank()) {
return@addListener
}
val searchMode = newValue.userData as SearchMode
model.search(textFieldSearch.text, searchMode)
}
} }
} }