Question

I'm trying make a "search by name" using JPAContainer Filter. Using Compare I still didn't have success. The comparison doesn't work, for example if I enter name: fernando, the filter doesn't work.

I'm trying this.

TextField searchByName = new TextField();
searchByName.setInputPrompt("Search by name");
searchByName.addBlurListener(new BlurListener() {           
@Override
public void blur(BlurEvent event) {
    nameFilter();
}
});


/** filter by name */
private void nameFilter(){
    if(!searchByName.getValue().isEmpty()){         
        Filter filter = new Compare.Equal("name", searchByName.getValue());
        datasource.addContainerFilter(filter);
    }
}

There's some way search with LIKE ???

Was it helpful?

OTHER TIPS

mySQLContainer.addContainerFilter(
    new Or(new And(new Equal("NAME", "Paul"),
                   new Or(new Less("AGE", 18),
                          new Greater("AGE", 65))),
           new Like("NAME", "A%")));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top