1. #1
    Ext User lvanderree's Avatar
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    181
    Vote Rating
    0
    lvanderree is on a distinguished road

      0  

    Default [2.0b1][CLOSED] Grouping and sorting

    [2.0b1][CLOSED] Grouping and sorting


    Last night I replied to a post about a problem in the help-topic (http://extjs.com/forum/showthread.php?t=14958), but I think it is more appropriate over here. (Ps. Title should say 2.0B1)

    I added some screenshots and the JSON-data to make the problem more clear.

    I think the problem is that because a grid can only store one sort-column, you get unexpected results when you sort in a grouped-grid.

    I for example have an overview of assignments, which I show in descending order (red). Every assignment can have one or more parcels (green) which I also show in descending order. See image and JSON-data:



    See the end of the lines for the parcel-subject Data.
    Code:
    {totalCount:"3", data:[
    
    {"assignment_subject":"3333","assignment_vessel":"Star Bonaire","assignment_sf_guard_user_related_by_created_by":"wouter", "assignment_created_at":"October 5, 2007 10:19 AM", "assignment_sf_guard_user_related_by_updated_by":"wouter", "assignment_updated_at":"October 5, 2007 10:19 AM", "assignment_assignmentid":"3", "assignmentparcel_assignmentparcelid":"8", "assignmentparcel_subject":"3333d"},
    
    {"assignment_subject":"3333", "assignment_vessel":"Star Bonaire", "assignment_sf_guard_user_related_by_created_by":"wouter", "assignment_created_at":"October 5, 2007 10:19 AM", "assignment_sf_guard_user_related_by_updated_by":"wouter", "assignment_updated_at":"October 5, 2007 10:19 AM", "assignment_assignmentid":"3", "assignmentparcel_assignmentparcelid":"7", "assignmentparcel_subject":"3333c"},
    
    {"assignment_subject":"3333","assignment_vessel":"Star Bonaire", "assignment_sf_guard_user_related_by_created_by":"wouter", "assignment_created_at":"October 5, 2007 10:19 AM","assignment_sf_guard_user_related_by_updated_by":"wouter", "assignment_updated_at":"October 5, 2007 10:19 AM", "assignment_assignmentid":"3", "assignmentparcel_assignmentparcelid":"6", "assignmentparcel_subject":"3333b"} ,
    
    {"assignment_subject":"3333", "assignment_vessel":"Star Bonaire", "assignment_sf_guard_user_related_by_created_by":"wouter", "assignment_created_at":"October 5, 2007 10:19 AM", "assignment_sf_guard_user_related_by_updated_by":"wouter", "assignment_updated_at":"October 5, 2007 10:19 AM", "assignment_assignmentid":"3", "assignmentparcel_assignmentparcelid":"5", "assignmentparcel_subject":"3333a"} 
    
    ,
    
    {"assignment_subject":"2222", "assignment_vessel":"Star Bonaire", "assignment_sf_guard_user_related_by_created_by":"admin", "assignment_created_at":"August 29, 2007 1:12 AM", "assignment_sf_guard_user_related_by_updated_by":"admin", "assignment_updated_at":"August 29, 2007 1:12 AM", "assignment_assignmentid":"2", "assignmentparcel_assignmentparcelid":"", "assignmentparcel_subject":""} 
    
    ,
    
    {"assignment_subject":"1111", "assignment_vessel":"Star Bonaire", "assignment_sf_guard_user_related_by_created_by":"admin", "assignment_created_at":"August 22, 2007 3:38 PM", "assignment_sf_guard_user_related_by_updated_by":"admin", "assignment_updated_at":"August 22, 2007 3:38 PM", "assignment_assignmentid":"1", "assignmentparcel_assignmentparcelid":"4", "assignmentparcel_subject":"1111d"},
    
    {"assignment_subject":"1111", "assignment_vessel":"Star Bonaire", "assignment_sf_guard_user_related_by_created_by":"admin", "assignment_created_at":"August 22, 2007 3:38 PM", "assignment_sf_guard_user_related_by_updated_by":"admin", "assignment_updated_at":"August 22, 2007 3:38 PM", "assignment_assignmentid":"1", "assignmentparcel_assignmentparcelid":"3", "assignmentparcel_subject":"1111c"},
    
    {"assignment_subject":"1111", "assignment_vessel":"Star Bonaire", "assignment_sf_guard_user_related_by_created_by":"admin", "assignment_created_at":"August 22, 2007 3:38 PM", "assignment_sf_guard_user_related_by_updated_by":"admin", "assignment_updated_at":"August 22, 2007 3:38 PM", "assignment_assignmentid":"1", "assignmentparcel_assignmentparcelid":"2", "assignmentparcel_subject":"1111b"},
    
    {"assignment_subject":"1111", "assignment_vessel":"Star Bonaire", "assignment_sf_guard_user_related_by_created_by":"admin", "assignment_created_at":"August 22, 2007 3:38 PM", "assignment_sf_guard_user_related_by_updated_by":"admin", "assignment_updated_at":"August 22, 2007 3:38 PM", "assignment_assignmentid":"1", "assignmentparcel_assignmentparcelid":"1","assignmentparcel_subject":"1111a"} 
    
    ]}
    Now I click on the Parcel-column-header, to change the sort-order of the parcels to ascending. The sorting is done remote and the JSON-data I receive now contains the assignments still in descending order, and the parcels in ascending order, but as you can see the Assignments are now also shown in ascending order...



    See the end of the lines for the parcel-subject Data.
    Code:
    {totalCount:"3", data:[
    
    {"assignment_subject":"3333","assignment_vessel":"Star Bonaire", "assignment_sf_guard_user_related_by_created_by":"wouter", "assignment_created_at":"October 5, 2007 10:19 AM", "assignment_sf_guard_user_related_by_updated_by":"wouter", "assignment_updated_at":"October 5, 2007 10:19 AM", "assignment_assignmentid":"3", "assignmentparcel_assignmentparcelid":"5", "assignmentparcel_subject":"3333a"},
    
    {"assignment_subject":"3333", "assignment_vessel":"Star Bonaire", "assignment_sf_guard_user_related_by_created_by":"wouter", "assignment_created_at":"October 5, 2007 10:19 AM", "assignment_sf_guard_user_related_by_updated_by":"wouter", "assignment_updated_at":"October 5, 2007 10:19 AM", "assignment_assignmentid":"3", "assignmentparcel_assignmentparcelid":"6", "assignmentparcel_subject":"3333b"},
    
    {"assignment_subject":"3333","assignment_vessel":"Star Bonaire",  "assignment_sf_guard_user_related_by_created_by":"wouter", "assignment_created_at":"October 5, 2007 10:19 AM", "assignment_sf_guard_user_related_by_updated_by":"wouter", "assignment_updated_at":"October 5, 2007 10:19 AM", "assignment_assignmentid":"3", "assignmentparcel_assignmentparcelid":"7", "assignmentparcel_subject":"3333c"},
    
    {"assignment_subject":"3333", "assignment_vessel":"Star Bonaire", "assignment_sf_guard_user_related_by_created_by":"wouter", "assignment_created_at":"October 5, 2007 10:19 AM", "assignment_sf_guard_user_related_by_updated_by":"wouter", "assignment_updated_at":"October 5, 2007 10:19 AM", "assignment_assignmentid":"3", "assignmentparcel_assignmentparcelid":"8", "assignmentparcel_subject":"3333d"}
    
    ,
    
    {"assignment_subject":"2222", "assignment_vessel":"Star Bonaire", "assignment_sf_guard_user_related_by_created_by":"admin", "assignment_created_at":"August 29, 2007 1:12 AM", "assignment_sf_guard_user_related_by_updated_by":"admin", "assignment_updated_at":"August 29, 2007 1:12 AM", "assignment_assignmentid":"2", "assignmentparcel_assignmentparcelid":"", "assignmentparcel_subject":""}
    
    ,
    
    {"assignment_subject":"1111", "assignment_vessel":"Star Bonaire", "assignment_sf_guard_user_related_by_created_by":"admin", "assignment_created_at":"August 22, 2007 3:38 PM", "assignment_sf_guard_user_related_by_updated_by":"admin", "assignment_updated_at":"August 22, 2007 3:38 PM", "assignment_assignmentid":"1", "assignmentparcel_assignmentparcelid":"1", "assignmentparcel_subject":"1111a"},
    
    {"assignment_subject":"1111", "assignment_vessel":"Star Bonaire", "assignment_sf_guard_user_related_by_created_by":"admin", "assignment_created_at":"August 22, 2007 3:38 PM", "assignment_sf_guard_user_related_by_updated_by":"admin", "assignment_updated_at":"August 22, 2007 3:38 PM", "assignment_assignmentid":"1", "assignmentparcel_assignmentparcelid":"2", "assignmentparcel_subject":"1111b"},
    
    {"assignment_subject":"1111", "assignment_vessel":"Star Bonaire", "assignment_sf_guard_user_related_by_created_by":"admin", "assignment_created_at":"August 22, 2007 3:38 PM", "assignment_sf_guard_user_related_by_updated_by":"admin", "assignment_updated_at":"August 22, 2007 3:38 PM", "assignment_assignmentid":"1", "assignmentparcel_assignmentparcelid":"3", "assignmentparcel_subject":"1111c"},
    
    {"assignment_subject":"1111", "assignment_vessel":"Star Bonaire", "assignment_sf_guard_user_related_by_created_by":"admin", "assignment_created_at":"August 22, 2007 3:38 PM", "assignment_sf_guard_user_related_by_updated_by":"admin", "assignment_updated_at":"August 22, 2007 3:38 PM", "assignment_assignmentid":"1", "assignmentparcel_assignmentparcelid":"4", "assignmentparcel_subject":"1111d"} 
    
    ]}
    I suspect this is due to extjs only being able to sort on one column, maybe a nice solution can be found in this implementation: http://tablesorter.com/docs/

  2. #2
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,133
    Vote Rating
    322
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Yes, this can be seen also on examples http://extjs.com/deploy/ext-2.0-beta.../grouping.html Grouping by Industry and clicking on company then changes the order of groups and items as well.

    We will investigate it further and we will let you know what can be done about it.

  3. #3
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    16
    jack.slocum will become famous soon enough

      0  

    Default


    Do you have remoteSort set to true in your config? Can you post up some code.

    With remoteSort set to true, the grid and store will not reorder the records, you need to return them in the correct order. e.g. if the store passes you a groupBy of columnA and a sort of columnB, you will need to sort the data you return by columnA, then by columnB.

    The groups always display in ascending order, it does not match the order of data (unless you return the data in reverse).

    Since you are using remote sorting, there is no way the ordering can be a bug in Ext as Ext does not reorder the data. You need to return it in the order you want it displayed.
    Jack Slocum
    Ext JS Founder
    Original author of Ext JS 1, 2 & 3.
    Twitter: @jackslocum
    jack@extjs.com

  4. #4
    Ext User lvanderree's Avatar
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    181
    Vote Rating
    0
    lvanderree is on a distinguished road

      0  

    Default


    Hi Jack I don't think you can close this bug, because I think there does is a bug in extjs.

    As you could see in my JSON output, I provide the JSON-data in descending order, for the assignment-subjects (the column on which I group). And this only work out if I don't sort on any other column. As soon as I start sorting my data on for example ascending parcel-subjects (the first column you see) both the parcel-subjects as well as the assignment-subjects get sorted ascending, even though in the JSON-data everything is in the correct order (desc assignments and asc parcels).

    Here is the code of my (remotely sorting) datastore:
    Code:
         ds = new Ext.data.GroupingStore({
            // load using HTTP
            url: '/backend_dev.php/assignment/jsonList',
                 
            // create the Data reader
            reader: new Ext.data.JsonReader({
              id: 'assignmentparcel_assignmentparcelid',
              root: 'data',
              totalProperty: 'totalCount',
            }, [
              // add the mainclass primary key to the field mapping
              {name: 'assignment_assignmentid', mapping: 'assignment_assignmentid'}
              // add the subclass primary key to the field mapping
              ,{name: 'assignmentparcel_assignmentparcelid', mapping: 'assignmentparcel_assignmentparcelid'}
              // set up the mainclass fields mapping
              ,{name: 'assignment_subject', mapping: 'assignment_subject'}
              ,{name: 'assignment_clientcompany', mapping: 'assignment_clientcompany'}
              ,{name: 'assignment_vesselid', mapping: 'assignment_vesselid'}
              ,{name: 'assignment_agentcompany', mapping: 'assignment_agentcompany'}
              ,{name: 'assignment_berth', mapping: 'assignment_berth'}
              // set up the subclass fields mapping
              ,{name: 'assignmentparcel_subject', mapping: 'assignmentparcel_subject'}
              ,{name: 'assignmentparcel_productnameid', mapping: 'assignmentparcel_productnameid'}
              ,{name: 'assignmentparcel_quantity', mapping: 'assignmentparcel_quantity'}
              ,{name: 'assignmentparcel_stowage', mapping: 'assignmentparcel_stowage'}
            ]),
    
            groupField: 'assignment_subject', 
    
            sortInfo:{field: 'assignment_subject', direction: "desc"}, 
     
            // turn on remote sorting
            remoteSort: true
          });
    If you want to see more code, please ask, but because everything gets generated, and it is very much work in process, the code requires some clean-up (improved aligning, cleanup of commented-lines)

  5. #5
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    16
    jack.slocum will become famous soon enough

      0  

    Default


    As I stated above, the client code does not reorder the data if remoteSort is true. If you are using remote sorting and you want the groups in descending order you must return them in descending order.
    Jack Slocum
    Ext JS Founder
    Original author of Ext JS 1, 2 & 3.
    Twitter: @jackslocum
    jack@extjs.com

  6. #6
    Ext User lvanderree's Avatar
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    181
    Vote Rating
    0
    lvanderree is on a distinguished road

      0  

    Default


    I'm sorry, but it really does not work like you say.

    As I stated above, I am using remote-sorting, I return the JSON-data in the order I want to see it and it works the first time, but as soon as you sort one of the columns the grouping gets sorted as well.

    I have created a small and simple live demo to show it to you:
    http://fun4me.demon.nl/test/test_dev.php/item

    When you look at this list, you see a list of items, grouped per group (or groEp as it says in the json-data). Both the groups as well as the items are sorted descending.

    Now press the Name-column-header once, to change the sort-direction of the items. You will see that the groups will show up in ascending order as well! If you use Firebug, you can see that my JSON-Data is still sending the groups in descending order.

    And to further support my statement, while having the items sorted ascending. enter the URL again in the same browser! (I (or actually symfony) use(s) cookies to store the sort-direction, so now you load the entire page again, which gives you back the descended groups, with ascending items in it (because this order is stored in a session cookie).

    To start all over again, you have to remove your session-cookie...

    Do you now agree it probably is something in the Extjs library, or am I really missing the point?

  7. #7
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    16
    jack.slocum will become famous soon enough

      0  

    Default


    Your store isn't configured properly. Try adding remoteGroup:true. Local grouping will only work with local sorting as the 2 are intertwined.
    Jack Slocum
    Ext JS Founder
    Original author of Ext JS 1, 2 & 3.
    Twitter: @jackslocum
    jack@extjs.com

  8. #8
    Ext User lvanderree's Avatar
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    181
    Vote Rating
    0
    lvanderree is on a distinguished road

      0  

    Default


    Ah thank you,

    so besides remoteSort: true, you should also set remoteGroup:true, I did not knew nor expect this.

    Thanks

  9. #9
    Sencha - Services Team
    Join Date
    Mar 2007
    Location
    Foristell, MO
    Posts
    1,107
    Vote Rating
    3
    jratcliff is on a distinguished road

      0  

    Default


    Quote Originally Posted by jsakalos View Post
    Yes, this can be seen also on examples http://extjs.com/deploy/ext-2.0-beta.../grouping.html Grouping by Industry and clicking on company then changes the order of groups and items as well.

    We will investigate it further and we will let you know what can be done about it.
    @jsakalos - I'm seeing the same issue you have described that happens with the Grouping example. Is there a property that needs to be set or is this a bug? Basically, I need to sort the groupBy in descending order and have it stay that way while other columns are sorted in ascending or descending order.

  10. #10
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,133
    Vote Rating
    322
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    This was related to 2.0 beta. Is the problem apparent also in 2.2?

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar