This issue is happening in
SmartClient Version: v9.1p_2015-09-11/PowerEdition Deployment
and
SmartClient Version: v9.1p_2016-01-21/PowerEdition Deployment
I came across an issue when sorting a TreeGrid using the PAGED data fetch mode. This doesn't happen using LOCAL or BASIC. The sort appears to be happening on the next time the grid is redrawn. The example below puts a default descending sort on the id column. When the grid is rendered, the id column indicates it is sorted descending, but the data is ascending. If you scroll the grid down a couple lines, the data then sorts descending.
If you try to sort on any column, the grid draw will then sort on the previously chosen sort, so the redraw is not happening right away. If you scroll the grid, it will then redraw the grid using the desired sort.
SmartClient Version: v9.1p_2015-09-11/PowerEdition Deployment
and
SmartClient Version: v9.1p_2016-01-21/PowerEdition Deployment
I came across an issue when sorting a TreeGrid using the PAGED data fetch mode. This doesn't happen using LOCAL or BASIC. The sort appears to be happening on the next time the grid is redrawn. The example below puts a default descending sort on the id column. When the grid is rendered, the id column indicates it is sorted descending, but the data is ascending. If you scroll the grid down a couple lines, the data then sorts descending.
If you try to sort on any column, the grid draw will then sort on the previously chosen sort, so the redraw is not happening right away. If you scroll the grid, it will then redraw the grid using the desired sort.
Code:
final TreeGrid grid = new AsTreeGrid(); grid.setHeight(300); DataSource ds = new DataSource(); ds.setID("clientDS"); ds.setClientOnly(true); List<DataSourceField> dsFields = new ArrayList<DataSourceField>(); DataSourceField f = new DataSourceField("id", FieldType.INTEGER); f.setPrimaryKey(true); dsFields.add(f); dsFields.add(new DataSourceField("a", FieldType.TEXT)); dsFields.add(new DataSourceField("b", FieldType.TEXT)); ds.setFields(dsFields.toArray(new DataSourceField[] {})); grid.setSort(new SortSpecifier("id", SortDirection.DESCENDING)); grid.setDataSource(ds); grid.setAutoFetchData(true); grid.setLoadDataOnDemand(true); grid.setDataFetchMode(FetchMode.PAGED); final List<ListGridField> fields = new ArrayList<ListGridField>(); fields.add(new ListGridField("id", 75)); fields.add(new ListGridField("a", 75)); fields.add(new ListGridField("b", 75)); grid.setFields(fields.toArray(new ListGridField[0])); List<ListGridRecord> data = new ArrayList<ListGridRecord>(); for (int i = 10; i < 30; i++) { ListGridRecord r = new ListGridRecord(); r.setAttribute("id", i); r.setAttribute("a", "aaaaaa" + i); r.setAttribute("b", "bbbbbbb" + i); data.add(r); } grid.getDataSource().invalidateCache(); grid.invalidateCache(); ds.setCacheData(data.toArray(new ListGridRecord[] {}));
Comment