On a Text field, we were expecting the operator "greater than or equal to" to behave similar to "starts with" but that it would also match the data greater than as well. The "starts with" is case insensitive but the >= is not.
For example, I have the following data "abc", "Abc", "ABc", "ABC", "cba", "Cba", "CBa", "CBA".
If I filter with "starts with" and value of "a", I get the 4 abc rows as expected. However if I use "greater than or equal to" with the same value of "a", I only get rows "abc" and "cba".
Attached are screen shots.
Code to reproduce this:
Using SmartClient Version: v9.1p_2014-11-09/Pro Deployment (built 2014-11-09)
For example, I have the following data "abc", "Abc", "ABc", "ABC", "cba", "Cba", "CBa", "CBA".
If I filter with "starts with" and value of "a", I get the 4 abc rows as expected. However if I use "greater than or equal to" with the same value of "a", I only get rows "abc" and "cba".
Attached are screen shots.
Code to reproduce this:
Code:
public class Sandbox1 implements EntryPoint { DataSource dataSource; ListGrid grid; int counter = 0; ListGridRecord[] cacheData = new ListGridRecord[8]; public static final String fpk = "fieldPK"; public static final String f1 = "field1"; public static final String f2 = "field2"; public static final String f3 = "field3"; @Override public void onModuleLoad() { int i = 0; cacheData[i] = new ListGridRecord(); cacheData[i].setAttribute(fpk, i); cacheData[i].setAttribute(f1, "abc"); cacheData[i].setAttribute(f2, i * 10); cacheData[i].setAttribute(f3, new Date()); i++; cacheData[i] = new ListGridRecord(); cacheData[i].setAttribute(fpk, i); cacheData[i].setAttribute(f1, "Abc"); cacheData[i].setAttribute(f2, i * 10); cacheData[i].setAttribute(f3, new Date()); i++; cacheData[i] = new ListGridRecord(); cacheData[i].setAttribute(fpk, i); cacheData[i].setAttribute(f1, "ABc"); cacheData[i].setAttribute(f2, i * 10); cacheData[i].setAttribute(f3, new Date()); i++; cacheData[i] = new ListGridRecord(); cacheData[i].setAttribute(fpk, i); cacheData[i].setAttribute(f1, "ABC"); cacheData[i].setAttribute(f2, i * 10); cacheData[i].setAttribute(f3, new Date()); i++; cacheData[i] = new ListGridRecord(); cacheData[i].setAttribute(fpk, i); cacheData[i].setAttribute(f1, "cba"); cacheData[i].setAttribute(f2, i * 10); cacheData[i].setAttribute(f3, new Date()); i++; cacheData[i] = new ListGridRecord(); cacheData[i].setAttribute(fpk, i); cacheData[i].setAttribute(f1, "Cba"); cacheData[i].setAttribute(f2, i * 10); cacheData[i].setAttribute(f3, new Date()); i++; cacheData[i] = new ListGridRecord(); cacheData[i].setAttribute(fpk, i); cacheData[i].setAttribute(f1, "CBa"); cacheData[i].setAttribute(f2, i * 10); cacheData[i].setAttribute(f3, new Date()); i++; cacheData[i] = new ListGridRecord(); cacheData[i].setAttribute(fpk, i); cacheData[i].setAttribute(f1, "CBA"); cacheData[i].setAttribute(f2, i * 10); cacheData[i].setAttribute(f3, new Date()); final VLayout appLayout = new VLayout(); appLayout.setWidth100(); appLayout.setHeight100(); buildDataSource(); buildGrid(); final FilterBuilder fb = new FilterBuilder(); fb.setTopOperatorAppearance(TopOperatorAppearance.RADIO); fb.setTopOperator(LogicalOperator.AND); fb.setShowModeSwitcher(Boolean.TRUE); fb.setDataSource(dataSource); IButton filterButton = new IButton("Filter"); filterButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { grid.filterData(fb.getCriteria()); } }); appLayout.setMargin(5); appLayout.setMembersMargin(5); appLayout.addMembers(fb, filterButton, grid); appLayout.draw(); } private void buildGrid() { grid = new ListGrid(); grid.setWidth100(); grid.setHeight100(); grid.setDataFetchMode(FetchMode.PAGED); grid.setTitle("Test Grid"); grid.setAutoFetchData(true); ListGridField gfld1 = new ListGridField(f1, "Field 1"); ListGridField gfld2 = new ListGridField(f2, "Field 2"); ListGridField gfld3 = new ListGridField(f3, "Field 3"); grid.setFields(gfld1, gfld2, gfld3); grid.setDataSource(dataSource, grid.getAllFields()); } private void buildDataSource() { dataSource = new DataSource(); dataSource.setClientOnly(true); // dataSource.setDataFormat(DSDataFormat.JSON); DataSourceField fldId = new DataSourceField(fpk, FieldType.INTEGER); fldId.setPrimaryKey(true); DataSourceField fld1 = new DataSourceField(f1, FieldType.TEXT); DataSourceField fld2 = new DataSourceField(f2, FieldType.INTEGER); DataSourceField fld3 = new DataSourceField(f3, FieldType.DATE); dataSource.setFields(fldId, fld1, fld2, fld3); dataSource.setCacheData(cacheData); } }
Comment