我想知道是否有任何方法可以过滤已经过滤的商店。 让我们说我有一个网格和两个过滤器(F1和F2)。 现在,我正在做的是
if(!F1 & !F2)
{
grid.store.load().filterBy(function(record, id){
/*** My function to sort the entire store ***/
}, this);
}
else if(F1 & !F2){
grid.store.load().filterBy(function(record, id){
/*** My function to sort the entire store ***/
}, this);
}
else if (!F1 & F2) {
grid.store.load().filterBy(function(record, id){
/*** My function to sort the entire store ***/
}, this);
}
else if (F1 & F2){
grid.store.load().filterBy(function(record, id){
/*** My function to sort the entire store ***/
}, this);
}
我为该网格添加了越来越多的过滤器以及' else if
'正以指数方式增长......
此外,我在150k +记录上过滤,因此重置&&在任何更改时过滤所有记录都可能非常昂贵。
我想要的是
if (F1){
/** filter on the most recent version of the grid **/
}
if (F2){
/** filter on the most recent version of the grid **/
}
希望我很清楚,谢谢。
答案 0 :(得分:1)
使用System.out.println(gsonOptFact.toJson(new BasicObjectOptional(true)));
// {"someKey":"someValue","someNumber":42,"mayBeNull":null}
System.out.println(gsonOptFact.toJson(new ComplexObjectOptional(true)));
// {"theTitle":"Complex Object","stringArray":["Hello","World"],"theObject":{"someKey":"someValue","someNumber":42,"mayBeNull":null}}
// Now read back in:
String basic = "{\"someKey\":\"someValue\",\"someNumber\":42,\"mayBeNull\":null}";
String complex = "{\"theTitle\":\"Complex Object\",\"stringArray\":[\"Hello\",\"world\"],\"theObject\":{\"someKey\":\"someValue\",\"someNumber\":42,\"mayBeNull\":null}}";
String complexMissing = "{\"theTitle\":\"Complex Object\",\"theObject\":{\"someKey\":\"someValue\",\"mayBeNull\":null}}";
BasicObjectOptional boo = gsonOptFact.fromJson(basic, BasicObjectOptional.class);
System.out.println(boo);
// someKey = Optional[someValue], someNumber = Optional[42], mayBeNull = Optional.empty
ComplexObjectOptional coo = gsonOptFact.fromJson(complex, ComplexObjectOptional.class);
System.out.println(coo);
// theTitle = Optional[Complex Object], stringArray = Optional[[Optional[Hello], Optional[world]]], theObject = (Optional[someKey = Optional[someValue], someNumber = Optional[42], mayBeNull = Optional.empty])
ComplexObjectOptional coom = gsonOptFact.fromJson(complexMissing, ComplexObjectOptional.class);
System.out.println(coom);
// theTitle = Optional[Complex Object], stringArray = null, theObject = (Optional[someKey = Optional[someValue], someNumber = null, mayBeNull = Optional.empty])
。
store.getFilters().add()