Fixed table highlighting
Fixed live search table highlighting bug which caused random highlighted rows to appear
This commit is contained in:
parent
60e85fe782
commit
f281d46ffa
1 changed files with 8 additions and 2 deletions
|
@ -136,14 +136,18 @@ public class DictionaryController implements Initializable {
|
|||
|
||||
searchBox.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||
filteredList.setPredicate(dictionaryEntry -> {
|
||||
// If filter text is empty, display all dictionary entries
|
||||
if (newValue == null || newValue.isEmpty()) {
|
||||
|
||||
table.refresh(); // This fixes the table highlighting issue
|
||||
|
||||
if (newValue == null || newValue.isEmpty()) { // If filter text is empty, display all dictionary entries
|
||||
return true;
|
||||
}
|
||||
|
||||
// need all same case for compare.
|
||||
String lowerCaseFilter = newValue.toLowerCase();
|
||||
|
||||
|
||||
|
||||
if (dictionaryEntry.getWelsh().toLowerCase().contains(lowerCaseFilter)) {
|
||||
return true; // Filter matches Welsh
|
||||
} else if (dictionaryEntry.getEnglish().toLowerCase().contains(lowerCaseFilter)) {
|
||||
|
@ -151,7 +155,9 @@ public class DictionaryController implements Initializable {
|
|||
}else if (dictionaryEntry.getWordType().toLowerCase().contains(lowerCaseFilter)) {
|
||||
return true; // Filter matches Word Type
|
||||
}
|
||||
|
||||
return false; // No match
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Reference in a new issue