Results 1 to 4 of 4

Thread: [FIXED-129] Store sorting direction

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Touch Premium Member
    Join Date
    Dec 2007
    Posts
    110

    Default [FIXED-129] Store sorting direction

    When calling store.sort(), direction is ignored. Example:

    Code:
    var dsEvents = new Ext.data.Store({
      autoLoad: true,
      model: 'ministryEvents',
      storeId: 'mystoreEvents',
      proxy: {
        url: 'index.cfm?action=general.getMinistryEvents&ministryID=' + ministryID,
        type: 'ajax',
        reader: {
          type: 'json',
          root: 'RESPONSE.DATA'
        }
      }
    });
    
    dsEvents.load({
      callback: function(){
        dsEvents.sort("EVENTDATE", "DESC");
      }
    });
    This will sort ASC, unless we supply defaultSortDirection in the store's constructor as DESC per:


    Code:
    // the passed "direction" parameter is never used
    sort: function(sorters, direction, suppressEvent) {
    		
      sorters = sorters || this.sorters;
            
      direction = (this.sortToggle[name] || this.defaultSortDirection).toggle('ASC', 'DESC');
    ...
    Unless I am missing something painfully obvious, this is a bug. I would also suggest adding a sortInfo parameter to the store like ExtJS so we do not have to worry about sorting the store after it's loaded.

  2. #2
    Ext JS Premium Member SimonFlack's Avatar
    Join Date
    Jul 2010
    Location
    Norway
    Posts
    242

    Default

    I am also experiencing sort direction issues. Everytime I load data into a store the direction toggles between ASC and DESC no matter what I set.

  3. #3
    Sencha User edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939

    Default

    Thanks for the report. Store sorting behavior has now been updated to better reflect the current Ext JS 3.x approach, meaning that this:

    Code:
    store.sort('myField');
    store.sort('myField');
    Is now equivalent to:

    Code:
    store.sort('myField', 'ASC');
    store.sort('myField', 'DESC');
    When passing a single argument to sort like we do above, toggling of direction is handled internally per field by the Store. These changes will be present in the next release.
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

  4. #4

    Default

    testStore = Ext.create('Ext.data.Store', { fields: ['fieldName'], data : SeachFields.Records, remoteSort: false, sorters: { property: 'fieldName', direction: 'ASC' // or DESC }});

Similar Threads

  1. Default sort direction of data store in grid
    By jmei in forum Ext 1.x: Help & Discussion
    Replies: 15
    Last Post: 16 Aug 2016, 8:37 AM
  2. [OPEN] [FIXED-129][2.x/3.x] Opera 10 upload form
    By sanny in forum Ext 3.x: Bugs
    Replies: 20
    Last Post: 19 Sep 2011, 7:43 PM
  3. [FIXED-185] TabPanel with 'slide' animation should slide the other direction
    By orangechicken in forum Sencha Touch 1.x: Bugs
    Replies: 6
    Last Post: 13 Aug 2010, 1:02 AM
  4. Replies: 3
    Last Post: 9 Jan 2010, 7:33 AM
  5. Replies: 3
    Last Post: 21 Aug 2009, 6:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •