PDA

View Full Version : GXT2.2 beta : ListFilter - selected values



maticpetek
10 Aug 2010, 1:11 AM
Hello,
I have "ModelData" struct with two properties - "id" and "desc". Than I create ListStore with let we say 10 records and then ListFilter with this ListStore. On filter I call method ".setDisplayProperty("desc")", so visual values are what I expected.
But on server side (FilterPagingLoadConfig.getFilterConfigs(), ".getValue()" on given FilterConfig object), I only get String object with "desc_1,desc_2" values. I think we should have method on ListStore object where you could specify ModelData properties (in my example - "id") that is then send to server as part of FilterPagingLoadConfig object.

Regards,
Matic

genobis
19 Jan 2011, 7:59 AM
Bump! The same problem applies to final release of GXT 2.2. The only solution which comes to my mind is to override ListFilter class in a following way:



private String valueProperty=...;

public void setValueProperty(String valueProperty) {
this.valueProperty=valueProperty;
}

public Object getValue() {
final String oldDisplayProperty=getDisplayProperty();

setDisplayProperty(valueProperty);

final Object value=super.getValue();

setDisplayProperty(oldDisplayProperty);
}


This should work (haven't tested that yet), but is extremely dirty and highly depends on undocumented, internal GXT code. And breaks getValue() method, as it will behave differently (maybe this code shouldn't repeat?). And of course still doesn't allow to have custom value types (list of ints, for example, instead of strings). Is there any other workaround? The only other alternative that comes to my mind is writing custom ListFilter from scratch, which would hurt...