This duplicates another bug already reported in our system: TOUCH-3260
  1. #1
    Sencha User
    Join Date
    Sep 2011
    Location
    Boston
    Posts
    141
    Vote Rating
    6
    drb is on a distinguished road

      0  

    Default 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
    Browser versions tested against:
    • Chrome 21.0.1180.75 m
    DOCTYPE tested against:
    • html
    Description:
    • 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.
    Steps to reproduce the problem:
    • 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 result that was expected:
    • The list should sort.
    The result that occurs instead:
    • List remains unsorted.
    Test Case:
    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
    See this URL for live test case: none

    Debugging already done:
    • none
    Possible fix:
    • not provided
    Additional CSS used:
    • only defaults .css
    Operating System:
    • Windows 7

  2. #2
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    20
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Default


    Thank you for the report.

    Sencha Inc

    Jamie Avins

    @jamieavins

  3. #3
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    20
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Sencha Inc

    Jamie Avins

    @jamieavins

  4. #4
    Sencha User
    Join Date
    Sep 2011
    Location
    Boston
    Posts
    141
    Vote Rating
    6
    drb is on a distinguished road

      0  

    Default 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

Thread Participants: 1

Tags for this Thread