PDA

View Full Version : GXT : GridFilter



mask_hot
27 Jul 2010, 2:55 AM
is it possible to add "manually" a filter to a grid filter.
for example I want to set a remote prefilter before laod my data.

Something like this?


StoreFilter<BeanModel> filter = new StoreFilter<BeanModel>(){

public boolean select(Store<BeanModel> store, BeanModel parent,
BeanModel item, String property) {
// TODO Auto-generated method stub
System.out.println(item+" "+ property);
return false;
}

};
grid.getGrid().getStore().addFilter(filter);
grid.getGrid().getStore().getLoader().load();

sven
27 Jul 2010, 2:59 AM
Why do you want to prefilter old data, when you load new data? Does not make sense to me.

mask_hot
27 Jul 2010, 3:34 AM
I have not yet load my store, I just want to set a filter before load the data. In ExtJS I used to tuse BaseParams, but as I use GridFilters and so FilterPagingLoadConfig in my DAO.load function, I thought use the store filter thing...

sven
27 Jul 2010, 3:36 AM
You should only load the data that you need, so do the filtering serverside

mask_hot
27 Jul 2010, 3:50 AM
I agree and that's what I want to do. But I have to push a parameter to the server. I'm a 1-n relationship (cf screenshot) and I want to load grid data for the current playerId.

sven
27 Jul 2010, 3:54 AM
instad of calling load() use the load(loadConfig) method and create a loadconfig. Put the filterrules into that loadConfig and make the server to interprete this loadconfig

mask_hot
27 Jul 2010, 6:35 AM
it's ok like this.
thx

another question : is it relevant to specify my own filter types (as existing "string", "numeric" and co)?
I'm using GAE with JDO and I'm wondering if I should not "create" a "key" type for GAE datastore key filtering.