Results 1 to 4 of 4

Thread: Update to 2.2 broke sorting of MixedCollection

    Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-4426 in a recent build.
  1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    8
    Vote Rating
    1
      0  

    Default Update to 2.2 broke sorting of MixedCollection

    Hi. I have the following problem. After update to 2.2 from 2.1.1 my app suddenly started to crash. After some digging, I have figured out that the problem starts from the line:
    Code:
    this.collection.sort('position');
    where collection is instance of MixedCollection.
    That may sound weired, but what actually causes the problem is the way method initConfig changed from 2.1.1 to 2.2. When instance of Ext.util.Sorter is created, a config with root property set to undefined is being passed to it's constructor:
    Code:
    decodeSorters: function() {
    ...
    // config -> {root: undefined}
    Ext.create('Ext.util.Sorter', config);
    }
    In 2.1.1 this will leave _root property of the sorter class with its default value of null. However, in 2.2 initConfig changes this behaviour so that _root property will be set to undefined. That difference leads to a different behaviour of defaultSortFn inside sorter class because the value of _root is being strictly compared to null:
    Code:
    root = me._root,
    // ...
     if (root !== null) {
                item1 = item1[root];
                item2 = item2[root];
           }
    // ...
    So my question is - is this a bug or should I change configuration of the MixedCollection instance (for example, set the value of a sortRoot property)?

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,026
    Vote Rating
    1367
      0  

    Default

    Sounds like a bug. Can you post a test case and I can then push it into our bug tracker.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Jun 2012
    Posts
    8
    Vote Rating
    1
      0  

    Default

    Here is the test case for MixedCollection:
    Code:
    var x = new Ext.util.MixedCollection();
    x.add('a', {foo: 'bar'});
    x.add('b', {foo: 'bar'});
    x.sort('foo');
    I think this may be a consequence of another problem which I described in a different thread:
    http://www.sencha.com/forum/showthre...alues&p=962266

  4. #4
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,026
    Vote Rating
    1367
      0  

    Default

    Looks like the default sorter fn is looking for the root config which doesn't exist on the Sorter which is what throws the error.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

Posting Permissions

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