Announcement

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

    How to disable sorting when setGroupByField() feature is used

    I want to preserve the data record order when showing the data set by group. I tried to use setCanSort(false), setCanMultiSort(false) and setSortField(null) but nothing worked.

    See more details below:

    1. the *complete* SmartGWT or SmartClient version

    SmartClient Version: v9.0p_2013-08-27/PowerEdition Deployment (built 2013-08-27)

    2. browser(s) and version(s) involved
    FF 17.0.9

    3. for a server-side problem, the *complete* logs generated during processing of the failing request (do *not* trim to just the error message)
    N/A

    4. for any problem processing a server response, the actual response as shown in the RPC tab in the Developer Console
    N/A

    5. if there is a JavaScript error, the stack trace logged in the Developer Console (see FAQ)
    N/A

    6. sample code if applicable

    {
    mObjectDataSource = new RestDataSource() ;

    mObjectDataSource.setDataFormat(DSDataFormat.JSON);

    DataSourceTextField typeField = new DataSourceTextField(
    OBJECT_TYPE, "Type");
    DataSourceTextField nameField = new DataSourceTextField(
    OBJECT_NAME, "Name");
    mObjectDataSource.setFields(typeField, nameField);

    mObjectDataSource
    .setFetchDataURL("http://127.0.0.1:8888/data/objects.js");

    ListGridField objectNameField = new ListGridField(OBJECT_NAME);

    objectNameField.setCanSort(false);
    setCanSort(false);
    setCanMultiSort(false);

    setFields(objectNameField);
    setGroupStartOpen(GroupStartOpen.ALL);
    setGroupByField(OBJECT_TYPE);

    setShowAllRecords(true);
    setShowHeader(false);
    setSelectionType(SelectionStyle.NONE);

    setAutoFetchData(true);
    setDataSource(mObjectDataSource);
    }

    JSON data source:
    {
    "response": {
    "status": 0,
    "startRow": 0,
    "endRow": 9,
    "totalRows": 10,
    "data": [
    {"type": "type1", "name": "object1"},
    {"type": "type1", "name": "object2"},
    {"type": "type1", "name": "object3"},
    {"type": "type1", "name": "object4"},
    {"type": "type1", "name": "(more)"},
    {"type": "type2", "name": "object8"},
    {"type": "type2", "name": "object7"},
    {"type": "type2", "name": "object6"},
    {"type": "type2", "name": "object5"},
    {"type": "type2", "name": "(more)"}
    ]
    }
    }

    #2
    Can anybody help me? Thanks!

    I tried "setInitialSort(new SortSpecifier[] { new SortSpecifier(
    OBJECT_NAME, SortDirection.ASCENDING) });"

    "(more)" is being placed in the place as if the text is "more", not "(more)". Looks like only letters are considered by the default sorting method. Is there a way to override the sorting method that's being used by the grouping feature?

    I tried "setUseClientSorting(false)" and it does not help either.

    Comment


      #3
      This is assigned to a developer for investigation. We'll follow up when we have more information

      Regards
      Isomorphic Software

      Comment


        #4
        We're not reproducing a problem here against the 4.0p or 4.1p builds.
        Upon load of the grid we are seeing the (grouped) data showing up in the same order as returned by the server (see the attached screenshot).

        Can you clarify exactly what behaviour you're seeing?
        If what you're seeing differs from our screenshot, please let us know exactly what Browser / OS you're using and also confirm whether you're working in hosted / development mode or looking at the application compiled.

        Regards
        Isomorphic Software
        Attached Files

        Comment


          #5
          I'm using SmartClient Version: v9.0p_2013-08-27/PowerEdition Deployment (built 2013-08-27), FireFox version 17.0.9, and hosted/development mode.

          Originally posted by Isomorphic View Post
          We're not reproducing a problem here against the 4.0p or 4.1p builds.
          Upon load of the grid we are seeing the (grouped) data showing up in the same order as returned by the server (see the attached screenshot).

          Can you clarify exactly what behaviour you're seeing?
          If what you're seeing differs from our screenshot, please let us know exactly what Browser / OS you're using and also confirm whether you're working in hosted / development mode or looking at the application compiled.

          Regards
          Isomorphic Software

          Comment


            #6
            Upgrading to the latest nightly build should fix this issue for you. If the issue persists there, please let us know

            Regards
            Isomorphic Software

            Comment


              #7
              I've tried with SmartClient Version: v9.1p_2014-07-08/PowerEdition Deployment (built 2014-07-08) and still experience the same problem.

              Originally posted by Isomorphic View Post
              Upgrading to the latest nightly build should fix this issue for you. If the issue persists there, please let us know

              Regards
              Isomorphic Software

              Comment


                #8
                I tried the simple case (load the listgrid alone on the entry point) and it does work fine (no sorting automatically happened). So it must be something else in my code that has enabled the client sorting somewhere?? I'll check my code and report back. Thanks.

                Originally posted by mshen View Post
                I've tried with SmartClient Version: v9.1p_2014-07-08/PowerEdition Deployment (built 2014-07-08) and still experience the same problem.

                Comment


                  #9
                  The problem that I reported earlier has been fixed in SmartClient Version: v9.1p_2014-07-08/PowerEdition Deployment (built 2014-07-08). Thanks!

                  Originally posted by mshen View Post
                  I tried the simple case (load the listgrid alone on the entry point) and it does work fine (no sorting automatically happened). So it must be something else in my code that has enabled the client sorting somewhere?? I'll check my code and report back. Thanks.

                  Comment

                  Working...
                  X