I found a bug on the latest nightly build.
I am currently using: SmartClient Version: v10.0p_2015-05-25/LGPL Development Only (built 2015-05-25), but I was able to reproduce it with the build from (2015-06-11)
If we have a ListGrid with an initialCriteria, I expect that this criteria will be kept when I'm filtering the grid.
Everything works as expected just until I show a column that is not originally shown when the grid is drawn.
Example:
The following example is not showing any data, because I am trying to keep the example as simple as possible. The only issue is the filtering after the field 3 is shown.
1) Because initially a grid.fetch is made, so the base criteria is set up:
2) If I filter the field 1 with a value = 6, this is the result:
"event.getCriteria(): {operator=and, criteria=[{fieldName=f1, operator=equals, value=1}, {fieldName=f1, operator=iContains, value=6}], _constructor=AdvancedCriteria}"
3) If I add another filter on filed 2 with value = 7:
"event.getCriteria(): {operator=and, criteria=[{fieldName=f1, operator=equals, value=1}, {fieldName=f1, operator=iContains, value=6}, {fieldName=f2, operator=iContains, value=7}], _constructor=AdvancedCriteria}"
4) Now if I show the field f3 and filter field 3 with value = 8:
"event.getCriteria(): {f1=6, f2=7, f3=8}". This criteria is bogus and should not destroy the original criteria applied on the grid.
Isomorphic, please advise if I am missing some property that I have not set or it is an unexpected behavior.
System Details:
Windows 7 64 bit.
Browser: Chrome, IE11, maybe others.
GWT 2.7, Smartgwt 5.0.
SmartClient Version: v10.0p_2015-05-25/LGPL Development Only (built 2015-05-25).
I am currently using: SmartClient Version: v10.0p_2015-05-25/LGPL Development Only (built 2015-05-25), but I was able to reproduce it with the build from (2015-06-11)
If we have a ListGrid with an initialCriteria, I expect that this criteria will be kept when I'm filtering the grid.
Everything works as expected just until I show a column that is not originally shown when the grid is drawn.
Example:
Code:
package org.test.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.data.AdvancedCriteria;
import com.smartgwt.client.data.Criterion;
import com.smartgwt.client.types.OperatorId;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.events.FilterEditorSubmitEvent;
import com.smartgwt.client.widgets.grid.events.FilterEditorSubmitHandler;
public class MainEntryPoint implements EntryPoint {
@Override
public void onModuleLoad() {
ListGrid grid = new ListGrid();
grid.setShowFilterEditor(true);
grid.setWidth100();
grid.setHeight100();
grid.addFilterEditorSubmitHandler(new FilterEditorSubmitHandler() {
@Override
public void onFilterEditorSubmit(FilterEditorSubmitEvent event) {
SC.logWarn("event.getCriteria(): " + event.getCriteria().getValues());
}
});
DataSourceTextField f1 = new DataSourceTextField("f1", "Field 1");
f1.setCanFilter(true);
DataSourceTextField f2 = new DataSourceTextField("f2", "Field 2");
f2.setCanFilter(true);
DataSourceTextField f3 = new DataSourceTextField("f3", "Field 3");
f3.setCanFilter(true);
f3.setDetail(true);
DataSource datasource = new DataSource();
datasource.setClientOnly(true);
datasource.setFields(f1, f2, f3);
grid.setDataSource(datasource);
grid.fetchData(new AdvancedCriteria(OperatorId.AND, new Criterion[]{new Criterion("f1", OperatorId.EQUALS, 1)}));
RootPanel.get().add(grid);
}
}
1) Because initially a grid.fetch is made, so the base criteria is set up:
Code:
grid.fetchData(new AdvancedCriteria(OperatorId.AND, new Criterion[]{new Criterion("f1", OperatorId.EQUALS, 1)}));
"event.getCriteria(): {operator=and, criteria=[{fieldName=f1, operator=equals, value=1}, {fieldName=f1, operator=iContains, value=6}], _constructor=AdvancedCriteria}"
3) If I add another filter on filed 2 with value = 7:
"event.getCriteria(): {operator=and, criteria=[{fieldName=f1, operator=equals, value=1}, {fieldName=f1, operator=iContains, value=6}, {fieldName=f2, operator=iContains, value=7}], _constructor=AdvancedCriteria}"
4) Now if I show the field f3 and filter field 3 with value = 8:
"event.getCriteria(): {f1=6, f2=7, f3=8}". This criteria is bogus and should not destroy the original criteria applied on the grid.
Isomorphic, please advise if I am missing some property that I have not set or it is an unexpected behavior.
System Details:
Windows 7 64 bit.
Browser: Chrome, IE11, maybe others.
GWT 2.7, Smartgwt 5.0.
SmartClient Version: v10.0p_2015-05-25/LGPL Development Only (built 2015-05-25).
Comment