Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-8756 in 4.2.0.663.
  1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    21
    Vote Rating
    5
    Navaar is on a distinguished road

      0  

    Default NodeInterface removeAll() removes related node data too early

    NodeInterface removeAll() removes related node data too early


    Hello again,

    In 4.2.0.489 the NodeInterface.removeAll() function sets the previousSibling, nextSibling, and parentNode values of all childNodes to null before it fires the 'remove' event.

    This causes a TreeStore.reload() call with a "node" specified in the options object to remove more nodes than it should when reloading a node with at least one child node and one grandchild node expanded. The issue is in NodeStore.onNodeRemove() when it calls onNodeCollapse(). onNodeCollapse() tries to figure out where the node is in the tree, and since it's parent and sibling nodes have already been set to null it just removes the rest of the tree.

    Here is an example
    Code:
    Ext.create('Ext.tree.Panel', {
        dockedItems: [
            {
                xtype: 'toolbar',
                dock: 'top',
                items: [
                    {
                        xtype: 'button',
                        text: 'Test',
                        handler: function() {
                            var me = this;
                            var store = me.up('treepanel').getStore();
                            var item = store.getById('p4');
                            item.removeAll();
                        }
                    }
                ]
            }
        ],
        store: Ext.create('Ext.data.TreeStore', {
            root: {
                text: 'Ext JS',
                id: 'root',
                expanded: true,
                children: [
                    {
                        text: 'parent',
                        id: 'p1',
                        expanded: true,
                        children: [
                            {
                                text: 'Parent 4',
                                id: 'p4',
                                expanded: true,
                                children: [
                                    {
                                        text: 'Parent 3',
                                        id: 'p3',
                                        expanded: true,
                                        children: [
                                            {
                                                text: 'Parent 2',
                                                id: 'p2',
                                                expanded: true,
                                                children: [
                                                    {
                                                        leaf: true,
                                                        text: 'child 1',
                                                        id: 'p2c1'
                                                    },
                                                    {
                                                        leaf: true,
                                                        text: 'child 2',
                                                        id: 'p2c2'
                                                    }
                                                ]
                                            }
                                        ]
                                    }
                                ]
                            },
                            {
                                text: 'Parent 5',
                                id: 'p5',
                                expanded: true,
                                children: [
                                    {
                                        leaf: true,
                                        text: 'child 1',
                                        id: 'p4c1'
                                    },
                                    {
                                        leaf: true,
                                        text: 'child 2',
                                        id: 'p4c2'
                                    }
                                ]
                            }
    
    
    
    
                        ]
                    }
                ]
            },
            folderSort: true,
            sorters: [
                {
                    property: 'text',
                    direction: 'ASC'
                }
            ]
        }),
        title: 'Tree Edge case Tester',
        useArrows: true
    })
    If you click the "Test" button you will see that not only does Parent4 dissapear, but everything below it goes away as well.


    The solution seems to be to not alter the nodes position in the tree until after it has been removed.

    Hope that helps!

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,207
    Vote Rating
    858
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Thanks for the report.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1