다른 테이블에서 클릭 한 것을 기반으로 하나의 테이블을 필터링하는 방법을 궁금합니다. 예를 들어 국가 표에서 러시아를 클릭하면 러시아의 모든 사람들을 이름 표에 필터링해야합니다. vaadin을 사용하여이 작업을 수행하는 방법을 알고 싶습니다. 아래에 관련 코드를 추가했습니다. 국가 표는 국가를 클릭 할 때 이름 표를 필터링한다고 가정합니다. ,vaadin의 다른 테이블에서 테이블 필터링
public class CountryFilter implements Filter {
public String needle;
public CountryFilter(String needle) {
this.needle = needle;
}
public boolean appliesToProperty(Object id) {
return true;
}
public boolean passesFilter(Object itemId, Item item) {
String haystack = ("" + item.getItemProperty(Name) +
item.getItemProperty(Country)).toLowerCase();
return haystack.contains(needle);
}
}
여기 당신은 물론,에 대해 알려 선택 기준 테이블에 ValueChangeListener을 설정할 수 있습니다 필터
public void initCountrySearch() {
country.setSelectable(true);
country.setImmediate(true);
name.setVisibleColumns(new String[] {"name"});
country.setVisibleColumns(new String[] {"country"});
country.addValueChangeListener(new Property.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
// TODO Auto-generated method stub
data.name.removeAllContainerFilters();
data.name.addContainerFilter(new CountryFilter(event.getProperty().getValue().toString()));
}
});
}
예외를 추가 할 수 있습니까? – nexus