Announcement

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

    ListGrid SortSpecifier

    SmartClient Version: v9.1p_2014-06-04/Pro Deployment (built 2014-06-04)

    Is there a way to change the ListGrid SortSpecifier(s) and corresponding indicators in the ListGrid column headers without causing a client-side sort?

    For example, if I am populating a ListGrid using a ResultSet as follows:

    Code:
     Record[] recordList = response.getData();
     int length = (recordList == null) ? 0 : recordList.length;
     ResultSet resultSet = new ResultSet(dataSource);
     resultSet.setInitialLength(length);
     resultSet.setInitialSort(someNewSortSpecifiers);
     resultSet.setInitialData(recordList);
     resultSet.setCriteria(criteria);
     resultSet.setAllRows(recordList);
     listGrid.setData(resultSet);
    My assumption was that by setting "resultSet.setInitialSort(someNewSortSpecifiers);", when listGrid.setData() is called, the ListGrid SortSpecifier(s) and corresponding indicators would reflect the sortBy value, however, this does not seem to be the case. I don't believe this even updates the listGrid.getSort() value.

    Thanks
    Last edited by stonebranch2; 4 Jun 2014, 23:33.

    #2
    Is there a way to change the ListGrid SortSpecifier(s) and corresponding indicators in the ListGrid column headers without causing a client-side sort?
    Can you clarify this? Are you trying to make the sort indicators not actually reflect the current sort?

    As far as setting a sort direction on the ResultSet, this should work so long as you do not have parallel and conflicting settings on the grid.

    Comment


      #3
      I have a list grid with some initial sort specified, and the grid data is updated by calling listGrid.setData(...) with a new ResultSet. That ResultSet has an initial sort that could differ from the list grid initial sort/current sort. Furthermore, setAllRows is set on the ResultSet.

      Code:
       Record[] recordList = response.getData();
       int length = (recordList == null) ? 0 : recordList.length;
       ResultSet resultSet = new ResultSet(dataSource);
       resultSet.setInitialLength(length);
       [B]resultSet.setInitialSort(someNewSortSpecifiers);[/B]
       resultSet.setInitialData(recordList);
       resultSet.setCriteria(criteria);
       [B]resultSet.setAllRows(recordList);[/B]
      Under this scenario, my expectation was that the list grid sort would be updated based on the ResultSet initial sort when calling listGrid.setData(ResultSet) and that I would see the column header sort indicators as specified by someNewSortSpecifiers.

      Are my expectations valid?

      Thanks

      Comment


        #4
        That does seem like a reasonable thing for the grid to do for this special case of an already-populated ResultSet with a sort direction on it, and we'll look at adding that kind of auto-detection.

        In the meantime, a simple approach to get the same effect without any network fetches:

        1. set data to an empty RecordList
        2. change sort direction on grid to match ResultSet you are about to provide
        3. provide ResultSet via setData()

        Comment


          #5
          Thank you,
          I will experiment with the workaround.
          Regards

          Comment


            #6
            We've made a change that should address this for you - please retest with a build dated June 7 or later

            Comment


              #7
              Thank you, much appreciated. I will retest with the recommended build.

              Comment

              Working...
              X