Hi! Aim is to start FilterBuilder setting default AdvancedCriteria. To achieve it, I can extend the Showcase https://www.smartclient.com/smartgwt...r_builder_grid with a new function getDefaultCriteria(…) see code below. To call it inserted a new code line into existing GridNestedFilterBulderSample(). To achieve the aim I can do a) But I cannot set value 0 for numeric fields at first.
a) Setting String defaultName = "countryName"; in getDefaultCriteria();
a1) Country contains (empty) appears OK (our aim)
a2) Selecting Population greater than 0 (numeric field!) then 0 disappears (?)
a3) Another values are all in right, e.g. 1 gives 1.
b) Setting String defaultName = "x"; in getDefaultCriteria(); This is an invalid field name, see the function below.
b1) Code = (empty) appears (our aim unsatisfied)
b2) Selecting Population greater than 0 (numeric field!) then 0 appears (!)
How can I set the default starting AdvancedCriteria for FilterBuilder to achive 0 value for numeric fields?
GridNestedFilterBulderSample()
Reproduced:
FF ESR 24.8.1
GC Version 61.0.3163.100 (Offizieller Build) (64-Bit)
IE 11 Version 11.713.10586.0, Update 11.0.38 (KB3203621)
GWT Version : 2.6.0
SmartGWT Version : 6.0p (Tue Feb 28 12:52:00 CET 2017)
a) Setting String defaultName = "countryName"; in getDefaultCriteria();
a1) Country contains (empty) appears OK (our aim)
a2) Selecting Population greater than 0 (numeric field!) then 0 disappears (?)
a3) Another values are all in right, e.g. 1 gives 1.
b) Setting String defaultName = "x"; in getDefaultCriteria(); This is an invalid field name, see the function below.
b1) Code = (empty) appears (our aim unsatisfied)
b2) Selecting Population greater than 0 (numeric field!) then 0 appears (!)
How can I set the default starting AdvancedCriteria for FilterBuilder to achive 0 value for numeric fields?
GridNestedFilterBulderSample()
Code:
[B]final[/B] FilterBuilder filterBuilder = [B]new[/B] FilterBuilder(); filterBuilder.setDataSource(worldDS); [B]filterBuilder.setCriteria(getDefaultCriteria(filterBuilder));[/B] [B]final[/B] ListGrid countryGrid = [B]new[/B] ListGrid(); countryGrid.setWidth(550); countryGrid.setHeight(224); countryGrid.setDataSource(worldDS); countryGrid.setAutoFetchData([B]true[/B]);
Code:
private AdvancedCriteria getDefaultCriteria(FilterBuilder filterBuilder) { String name = null; String defaultName = "countryName"; // "x" for (DataSourceField dsf : filterBuilder.getDataSource().getFields()) { if (dsf.getName().equals(defaultName)) { name = dsf.getName(); break; } } if (name != null) { AdvancedCriteria initialCriteria = new AdvancedCriteria(); initialCriteria.setOperator(OperatorId.AND); Criterion crit = new Criterion(name, OperatorId.ICONTAINS, ""); initialCriteria.buildCriterionFromList(OperatorId.AND, new Criterion[] { crit }); return initialCriteria; } return new AdvancedCriteria(); }
FF ESR 24.8.1
GC Version 61.0.3163.100 (Offizieller Build) (64-Bit)
IE 11 Version 11.713.10586.0, Update 11.0.38 (KB3203621)
GWT Version : 2.6.0
SmartGWT Version : 6.0p (Tue Feb 28 12:52:00 CET 2017)
Comment