You found a bug! We've classified it as EXTJS-8604 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha Premium Member
    Join Date
    Oct 2012
    Location
    Philadelphia, PA
    Posts
    2
    Vote Rating
    1
    tazer84 is on a distinguished road

      1  

    Default NodeInterface.eachChild Scope does not iterate over children

    NodeInterface.eachChild Scope does not iterate over children


    Sorry if this is a dup. Couldn't find it in the Ext 4 list.

    NodeInterface.eachChild still has problems with scoping even after FIXED-1166. According to documentation:

    scope : Object (optional)
    The scope (this reference) in which the function is executed. Defaults to the current Node in iteration.
    The scope in the callback still defaults to the parent node and not the each child. Code to reproduce:

    Code:
    var store = new Ext.data.TreeStore({
        root : {
          id: 0, name: 'root', children: [
             { id: 1, name: 'child 1' },
             { id: 2, name: 'child 2' },
             { id: 3, name: 'child 3' }
          ]
       }
    });
    
    
    var myCallback = function callbackFunc ( node ) {
        console.log( "this", this.getId() ); // always reports id 0
        console.log( "node", node.getId() ); // correctly iterates through child id
    }
    
    store.getRootNode().eachChild( myCallback );
    Callback args default to passing in the current node in the iteration, but if I want to pass any of my own args into the callback, I lose the current node. Coupled with the scoping bug, this means I can't pass any vars into the callback without having to manually iterate through the children.

    Based on 4.1.3 source code, the following will fix the problem (offending line commented out and the fix immediately below it).

    Code:
    eachChild : function(fn, scope, args) {
        var childNodes = this.childNodes,
        length     = childNodes.length,
        i;
    
       for (i = 0; i < length; i++) {
    //    if (fn.apply(scope || this, args || [childNodes[i]]) === false) {
          if (fn.apply(scope || childNodes[i], args || [childNodes[i]]) === false) {
             break;
          }
       }
    },

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,782
    Vote Rating
    833
    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.

    Also, the link you specified was for Ext JS 3 so that fix has no bearing on this bug, this is just a regression between major versions.

  3. #3
    Sencha Premium Member
    Join Date
    Oct 2012
    Location
    Philadelphia, PA
    Posts
    2
    Vote Rating
    1
    tazer84 is on a distinguished road

      0  

    Default


    Cool beans. Linked the Ext3 issue in case you guys wanted to backport ando/or have an upstream from 3 to 4.

Thread Participants: 1

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