Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    TreeGrid sorting issue with working example

    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.

    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[] {}));

    #2
    This should be resolved in today's SGWT 4.1p/SC 9.1p builds (dated 2016-01-28).

    Comment


      #3
      This is still broken in the 2016-01-28 and 2016-01-29 builds. The initial sort is now showing up correctly with my example above, but if you change the sort to be ascending, the data is still in descending order. If you scroll the grid after changing the sort, then it will redraw with the data sorted correctly.

      If you only change sorting directions on columns in the grid, it is always one sort behind. So the first sort that the user requests is not forcing a redraw, but each successive sort is forcing the previously requested redraw.

      Comment


        #4
        We've committed some additional fixes to SGWT 4.1p/SC 9.1p to address the remaining issues you reported. These should be in the next nightly builds. Note that you may wish to consider upgrading to a newer release, such as SGWT 5.xp, as newer releases receive patches more quickly, and in some cases more complicated fixes might be applied only to the last release or two.

        Comment


          #5
          This is working in the nightly build from 2016-01-31.

          Thanks.

          Comment

          Working...
          X