GXT3 Whole Grid Filtering

This the code to perform the whole grid filtering

pagingGridControl.getStore().addFilter(new StoreFilter() {
  @Override
  public boolean select(Store store, Object parent, Object item) {
    if(txtKeyword.getValue()==null){
      return true;
    }else{
      if(txtKeyword.getValue().trim().equals("")){
        return true;
      }
      
      Cheap_Sale_AllowedBean obj=(Cheap_Sale_AllowedBean) item;
      String sKeyword=txtKeyword.getValue();
      AutoBean<Cheap_Sale_AllowedBean> bean = AutoBeanUtils.getAutoBean(obj);
      Map<String,Object> map= AutoBeanUtils.getAllProperties(bean);
      for (String s : map.keySet()) {
        //Console.writeLine(s + "=" + map.get(s));
        if(map.get(s) !=null){
          if(map.get(s).toString().toLowerCase().indexOf(sKeyword) > -1){
            Console.writeLine(s + "=" + map.get(s));    
            return true;
          }
        }
      }          
    }
    return false;
  }
});

pagingGridControl.getStore().setEnableFilters(true);

The store filters must be enabled.

Source : http://www.sencha.com/forum/showthread.php?270023-Grid-Search

1 comments:

Neil Coder said...

Hi, this is really useful, thanks!

I just wanted to ask you; is the pagingGridControl an instance of the GXT Grid?

 
Copyright © peyotest