You found a bug! We've classified it as EXTJS-7401 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Ext JS Premium Member anton.dimitrov's Avatar
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    130
    Vote Rating
    5
    anton.dimitrov is on a distinguished road

      0  

    Default Ext.data.TreeStore.removeAll() should respect the 'silent' config

    Ext.data.TreeStore.removeAll() should respect the 'silent' config


    Ext version tested:
    • Ext 4.x
    Description:
    • The remoevAll() method of Ext.data.TreeStore should accept a parameter to control the 'silent' removing of records just like Ext.data.Store
    • The current implementation of Ext.data.TreeStore.removeAll() is
      Code:
      // inherit docs
          removeAll: function() {
              var root = this.getRootNode();
              if (root) {
                  root.destroy(true);
              }
              this.fireEvent('clear', this);
          },
    Fix:
    Code:
    // inherit docs
        removeAll: function(silent) {
            var root = this.getRootNode();
            if (root) {
                root.destroy(true);
            }
            
           if(silent !== true){
              this.fireEvent('clear', this);
           }
    
    
    
    
        },

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,817
    Vote Rating
    608
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Not really a bug, since the docs don't list it as a parameter, but would be nice to have for consistency.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Ext JS Premium Member anton.dimitrov's Avatar
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    130
    Vote Rating
    5
    anton.dimitrov is on a distinguished road

      0  

    Default


    True.
    Is there a bug with destroying records in TreeStore? I see that when removeAll() is called all children of the tree generate a request to the server-side 'destroy' operation. this should not be the case when the node is destroyed with silent = true , right ?

    Code:
    removeAll: function() {
            var root = this.getRootNode();
            if (root) {
                root.destroy(true); // -> this should ensure no destroy operations are performed , but it doesn't ?
            }
            this.fireEvent('clear', this);
        },

  4. #4
    Ext JS Premium Member anton.dimitrov's Avatar
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    130
    Vote Rating
    5
    anton.dimitrov is on a distinguished road

      0  

    Default


    Since remove all on TreeStore triggers the destroy operation on the store proxy I have created an override to support the silent config on the TreeStore.
    When the root is destroyed this triggers the destruction of all its children and executes the 'destroy' operation on all of them. I don't think that should be happening when silent removing is used just like it doesn't with the regular Ext.data.Store.

    Any improvements are more than welcomed!


    Code:
    Ext.define('Ext.overrides.data.TreeStore', {
    
        override: 'Ext.data.TreeStore',
    
        removeAll: function(silent) {
            var me = this,
                root = me.getRootNode();
    
            if(silent !== true){
                if (root) {
                    // will fire the 'destroy' operation for every child of the root
                    root.destroy(true);
                }
               //fire the clear even only if not silent
                this.fireEvent('clear', me);
            }else{
                if (root) {
                    // temporarily remove the onNodeRemove event listener so that when removeAll is called,
                    // the removed nodes do not get added to the removed array
                    me.tree.un('remove', me.onNodeRemove, me);
    
                    root.removeAll(false); // silent remove all children
                    root.destroy(false); // destroy just the root
    
                    // reattach the onNodeRemove listener
                    me.tree.on('remove', me.onNodeRemove, me);
                }
            }
        }
    
    });

Thread Participants: 1

Tags for this Thread

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..." hd porno faketaxi