-
13 Aug 2012 4:51 PM #1
NestedList sort does not work with property-direction specification
NestedList sort does not work with property-direction specification
REQUIRED INFORMATION
Ext version tested:- Sencha Touch 2.0.1.1
- Chrome 21.0.1180.75 m
- html
- Trying to sort a NestedList using the NodeStore.sort and parentNode.sort with a { "property" ... "direction" ...} does not work.
- Using a sortFn does work, BTW.
- Run the code below
- Tap on Drinks, Water, and then tap on any row. The list should have sorted
- Edit the code below inside leafitemtap to select a different sort mechanism.
- You will see that the sort function will work, but not a sort specification.
- The list should sort.
- List remains unsorted.
Code:Ext.setup({ onReady: function () { var data = { text: 'Groceries', items: [{ text: 'Drinks', items: [{ text: 'Water', items: [{ text: 'Sparkling', leaf: true }, { text: 'Still', leaf: true }, { text: 'Deep', leaf: true }, { text: 'Muddy', leaf: true }] }] }] }; Ext.define('ListItem', { extend: 'Ext.data.Model', config: { fields: [{ name: 'text', type: 'string' }] } }); var store = Ext.create('Ext.data.TreeStore', { model: 'ListItem', defaultRootProperty: 'items', root: data }); var nestedList = Ext.create('Ext.NestedList', { fullscreen: true, title: 'Groceries', displayField: 'text', store: store, listeners: { leafitemtap: function (nlist, list, index, element, record, e, opts) { console.log(record.get("text")); //record.parentNode.appendChild({ "text": "Added", "leaf": true }); //record.parentNode.insertChild(index, { "text": "Inserted", "leaf": true }); if (true) { // should work but does not list.getStore().sort([{ "property": "text", "direction": "ASC"}]); } if (false) { // Does work record.parentNode.sort(function (rec1, rec2) { var val1 = rec1.get("text"); var val2 = rec2.get("text"); if (val1 > val2) { return 1; } if (val1 = val2) { return 0; } return -1; }, false, false); } if (false) { // Also should work but does not record.parentNode.sort([{ "property": "text", "direction": "ASC"}]); } } } }); } });
HELPFUL INFORMATION
Screenshot or Video:- none
Debugging already done:- none
- not provided
- only defaults .css
- Windows 7
-
15 Aug 2012 11:16 AM #2Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,652
- Vote Rating
- 14
Thank you for the report.
-
21 Aug 2012 11:10 AM #3Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,652
- Vote Rating
- 14
-
21 Aug 2012 11:16 AM #4
NO, there are 2 separate problems - Sort and Insert
NO, there are 2 separate problems - Sort and Insert
This bug is about Sort not working.
The other bug is about Insert-Child not working.
The other bug has comments in it about this bug. Those comments should be in this bug.
But this bug is still a bug. (I think.)
-David
This duplicates another bug already reported in our system:
TOUCH-3260


Reply With Quote