Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-7916 in a recent build.
  1. #1
    Ext JS Premium Member
    Join Date
    Oct 2007
    Posts
    85
    Vote Rating
    4
    lagnat is on a distinguished road

      0  

    Default [4.1.3] Tree node removeAll(true) throws exception when there's a child node.

    [4.1.3] Tree node removeAll(true) throws exception when there's a child node.


    TypeError: 'undefined' is not a function (evaluating 'store.remove(me, true)')

    Code:
        var store = new Ext.data.TreeStore({
            fields: [{
                name: 'text'
            }]
        });
    
        var tree = new Ext.tree.TreePanel({
            store: store,
            rootVisible: false,
            title: 'Remove all',
            renderTo: Ext.getBody(),
            width: 200,
            height: 200,
            x: 10,
            y: 10,
            tbar: {
                items: [{
                    text: 'Remove All',
                    handler: function()
                    {
                        store.getRootNode().removeAll(true);
                    }
                }]
            }
        });
    
        var node = store.getRootNode().appendChild({
            text: 'foo',
            id: 1235,
            expandable: true,
            leaf: false
        });
    
        node.appendChild({
            text: 'bar',
            id: 6789,
            expandable: false,
            leaf: true
        });

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Vote Rating
    846
    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! I have opened a bug in our bug tracker.

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    5
    Vote Rating
    0
    alsid is on a distinguished road

      0  

    Default


    Hi everybody,

    I'm also getting some problems when trying to call node.remove(true). When node doesn't have any leafs everything's fine. If there are child nodes - I'm getting following error:

    Uncaught TypeError: Object [object Object] has no method 'remove'




    It seems that while deleting each child node the reference to the store to wich this node belongs is not empty:

    • store: constructor
    • stores: Array[1]

    That's why there is an attemt to call remove function from the store containing node:

    store.remove(me, true);

    And, according the documentation there is no remove method in Ext.data.TreeStore class.

Thread Participants: 2