code: function(parent, records, suppressEvent, callback, scope) {
          var me = this,
              collapseIndex = me.indexOf(parent) + 1,
              node, lastNodeIndexPlus, sibling, found;
  
          if (!me.recursive && parent !== me.node) {
              return;
          }
  
          // Used by the TreeView to bracket recursive expand & collapse ops.
          // The TreeViewsets up the animWrap object if we are animating.
          // It also caches the collapse callback to call when it receives the
          // end collapse event. See below.
          if (!suppressEvent) {
              me.fireEvent('beforecollapse', parent, records, collapseIndex, callback, scope);
          }
  
          // Only attempt to remove the records if they are there.
          // Collapsing an ancestor node *immediately removes from the view, ALL its descendant nodes at all levels*.
          // But if the collapse was recursive, all descendant root nodes will still fire their
          // events. But we must ignore those events here - we have nothing to do.
          if (records.length && me.data.contains(records[0])) {
              
              // Calculate the index *one beyond* the last node we are going to remove
              // Need to loop up the tree to find the nearest view sibling, since it could
              // exist at some level above the current node.
              node = parent;
              while (node.parentNode) {
                  sibling = node.nextSibling;
                  if (sibling) {
                      found = true;
                      lastNodeIndexPlus = me.indexOf(sibling); 
                      break;
                  } else {
                      node = node.parentNode;
                  }
              }
              if (!found) {
                  lastNodeIndexPlus = me.getCount();
              }
  
              // Remove the whole collapsed node set.
              me.removeAt(collapseIndex, lastNodeIndexPlus - collapseIndex);
          }
  
          // Triggers the TreeView's onCollapse method which calls refreshSize,
          // and fires its afteritecollapse event
          if (!suppressEvent) {
              me.fireEvent('collapse', parent, records, collapseIndex);
          }
      }
docs: Triggered by a NodeInterface's bubbled "collapse" event.