1. #1
    Sencha Premium Member Zdeno's Avatar
    Join Date
    Nov 2009
    Location
    Prague
    Posts
    326
    Vote Rating
    12
    Zdeno will become famous soon enough

      0  

    Default rejectChanges - Ext.data.TreeStore

    rejectChanges - Ext.data.TreeStore


    Hello,

    i would like to ask you if anyone found way how to reject changes in treestore when you get exception on sync(). I already checked this forum but found information bout rejectChanges on Ext.data.Store only. So i wanted override Ext.data.treestore add rejectChanges function but i found one big problem.

    As you know property removed collecting all removed nodes with relations except relation to parent node in store. Basically you can rebuild tree from array removed but you dont have information bout relation to parent node or previous/nextSibling so you dont know where to this rebuilded tree put.

    Is this bug or can i read these information somewhere in structure?

  2. #2
    Sencha Premium Member Zdeno's Avatar
    Join Date
    Nov 2009
    Location
    Prague
    Posts
    326
    Vote Rating
    12
    Zdeno will become famous soon enough

      0  

    Default


    I think i found the problem? Function remove on node will call removeChild function with params: this, destroy, suppressEvents (NodeInterface.js: 844). Destroy tell us, if the node will be destroyed upon removal or not. Function removeChild on line 650-654 has condition:

    Code:
    if (destroy) {
        node.destroy(true);
    } else {
        node.clear();
    }
    So when i follow the code we need to know what does clear function do.

    Code:
    ...
    /**
     * Clears the node.
     * @private
     * @param {Boolean} [destroy=false] True to destroy the node.
     */
    clear : function(destroy) {
        var me = this;
    
    
        // clear any references from the node
        me.parentNode = me.previousSibling = me.nextSibling = null;
        if (destroy) {
            me.firstChild = me.lastChild = null;
        }
    },
    ...
    So how it looks, problem is in clear function. After we call this function, any references will be removed. So after that call you will loose all informations to reject changes.

    Anybody from Sencha can confirm this problem?

  3. #3
    Sencha - Community Support Team mankz's Avatar
    Join Date
    Nov 2007
    Location
    Helsingborg, Sweden
    Posts
    2,454
    Vote Rating
    48
    mankz is a jewel in the rough mankz is a jewel in the rough mankz is a jewel in the rough

      0  

    Default


    +1, would be nice with a solution to this issue.

  4. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    7,183
    Vote Rating
    194
    scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold

      0  

    Default


    This has been submitted: EXTJSIV-6804

    Regards,
    Scott.

  5. #5
    Ext JS Premium Member
    Join Date
    Jul 2011
    Posts
    12
    Vote Rating
    0
    adp-gmt is on a distinguished road

      0  

    Default


    Hello,
    I have the same problem (no rejectChanges method for TreeStore).
    Could you tell me more about the solution?
    Where can I find this EXTJSIV-6804?
    When I get an exception how to restore the node that the user wanted to remove or delete the node that the user wanted to add?


  6. #6
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    7,183
    Vote Rating
    194
    scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold

      0  

    Default


    This is an internal ID for our bug tracking software. At this time, it is slated for our 4.2 release (no public date).

    We do not provide public access to our tracking software at this time.

    Scott.

  7. #7
    Sencha User
    Join Date
    Dec 2011
    Posts
    1
    Vote Rating
    0
    andr-04 is on a distinguished road

      0  

    Default Ext JS 4.2.0 RC 1 (4.2.0.489)

    Ext JS 4.2.0 RC 1 (4.2.0.489)


    I have not found rejectChanges for Ext.data.TreeStore in RC 1. Will it be in RC 2 or later?