-
27 Apr 2013 5:45 AM #1
Update to 2.2 broke sorting of MixedCollection
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:
where collection is instance of MixedCollection.Code:this.collection.sort('position');
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:
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:decodeSorters: function() { ... // config -> {root: undefined} Ext.create('Ext.util.Sorter', config); }
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)?Code:root = me._root, // ... if (root !== null) { item1 = item1[root]; item2 = item2[root]; } // ...
-
29 Apr 2013 5:22 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,710
- Vote Rating
- 436
Sounds like a bug. Can you post a test case and I can then push it into our bug tracker.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
30 Apr 2013 12:31 AM #3
Here is the test case for MixedCollection:
I think this may be a consequence of another problem which I described in a different thread:Code:var x = new Ext.util.MixedCollection(); x.add('a', {foo: 'bar'}); x.add('b', {foo: 'bar'}); x.sort('foo');
http://www.sencha.com/forum/showthre...alues&p=962266
-
30 Apr 2013 5:20 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,710
- Vote Rating
- 436
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 @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
Success! Looks like we've fixed this one. According to our records the fix was applied for
TOUCH-4426
in
Sprint 33.


Reply With Quote