Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Create search field. JPAcontainers
kindly view the code to create a search field for a table. I'm using JPA containers btw. when i go to type in the searcg tge table is cleared instead of a filter/search.
private Component buildFilter() {
searchField = new TextField();
searchField.setInputPrompt("Search");
searchField.addTextChangeListener(new FieldEvents.TextChangeListener() {
@Override
public void textChange(final FieldEvents.TextChangeEvent event) {
orderDetailList.removeAllContainerFilters();
orderDetailList.addContainerFilter(new JPAContainer.Filter() {
@Override
public boolean passesFilter(final Object itemId,
final Item item) {
if (event.getText() == null
|| event.getText().equals("")) {
return true;
}
return filterByProperty("inmas.inDes", item,
event.getText())
|| filterByProperty("quantity", item,
event.getText())
|| filterByProperty("onHand", item,
event.getText());
}
@Override
public boolean appliesToProperty(final Object propertyId) {
if (propertyId.equals("inmas.inDes")
|| propertyId.equals("required")
|| propertyId.equals("bondQty")) {
return true;
}
return false;
}
});
}
});
searchField.setIcon(FontAwesome.SEARCH);
searchField.setWidth(39.8f, Sizeable.Unit.EM);
searchField.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
return searchField;
}