Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-3259 in a recent build.
  1. #1
    Sencha User
    Join Date
    Sep 2011
    Location
    Boston
    Posts
    138
    Vote Rating
    6
    drb is on a distinguished road

      0  

    Default NestedList NodeInterface insertChild does not display in correct order in List

    NestedList NodeInterface insertChild does not display in correct order in List


    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:
    • In Touch 2.0.1.1 (and 2.0), inserting an item does insert it into the children, but the inserted item is displayed at the end of the List.
    Steps to reproduce the problem:
    • Run the code below.
    • Tap on Drinks, then Water, then any row
    • The Insert row should be in front of the row just tapped, but it is as the end.
    • Back all the way back to Groceries and then forward again to Waters and you will see that it is now in the correct position. This is because there are only 2 Lists in a NestedList and the List has been refreshed, showing the actual position from the node's children.
    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 (false) {
                            // 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
    Last edited by drb; 15 Aug 2012 at 11:25 AM. Reason: Modified last Step to reproduce to be clearer.

  2. #2
    Sencha - Sencha Touch Dev Team 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. This may have been fixed in a patch version, we'll verify and get back to you.

    Sencha Inc

    Jamie Avins

    @jamieavins

  3. #3
    Sencha - Sencha Touch Dev Team 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


    Scenario 1: Since NestedList uses a TreeStore, you would need to sort the nlist in your example instead of the list.

    Scenario 2: This works here because you are calling the nodeInterface's sort method directly and use a sortFn.

    Scenario 3: This doesn't work because nodeInterface's sort method doesn't currently accept that syntax.

    We're looking into what can be done to help make this easier in the future. Note that much of the reasoning behind how it works now is we don't have a very good way to determine if the call to sort is coming from an internal method (the TreeStore) or a developer call (just a NodeInterface). This can lead to recursion problems in the current implementation and it's why we have some of the limitations.

    Sencha Inc

    Jamie Avins

    @jamieavins

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

      0  

    Default Above comment belongs with the Sort bug I reported

    Above comment belongs with the Sort bug I reported


    Jamie,
    Can you move the comment to the right bug?
    Thanks David

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

      0  

    Default Is there any workaround for the failure to display in the right order?

    Is there any workaround for the failure to display in the right order?


    Thanks
    David

  6. #6
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    10
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    I'm pretty sure this issue has been fixed as part of a previous release. The testcases we have for this issue (which is based on your provided testcase) runs correctly in the 2.2 codebase for me.

    Please let me know if anyone still has this issue or something related to it and I will reopen.

    Best,
    Tommy

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."