title: Code Structure with ExtJS
body: <p>I'm trying to organize my ExtJS javascript a little better. I've an ExtJS object like this:</p>
  
  <pre><code>Ext.define('QBase.controller.ControlModelConfigurationController', {
      extend: 'Ext.app.Controller',
  
      views: [
          'ControlModelConfiguration'
      ],
  
      init: function() {
          console.log('Initialized ControlModelConfigurationController');
          this.control({
              '#testBtn': {
                  click: this.loadModel
              }
          });
      },
  
      loadModel: function() {
          console.log('Load Model....');
          var conn = new Ext.data.Connection; 
          conn.request({ 
                          url: 'partsV10.xml',  
                          callback: function(options, success, response) 
                          {  
                              if (success) 
                              { 
                                alert("AHHH");
                                var dq = Ext.DomQuery; 
                                var xml = response.responseXML; 
                                var nodes = dq.select('part', xml,parent);  
                                Ext.Array.forEach(nodes,handleNode);
                               } 
                          }
          });
      },
      handleNode: function(items) {
          console.log(item.name);
      }  
  });
  </code></pre>
  
  <p>The posted code above is not working. Ext.Array.forEach(nodes,handleNode) causes trouble. Instead of using an anonymous function like :</p>
  
  <pre><code>...
  Ext.Array.forEach(nodes,function(item) {
      console.log(item)});
  }
  ...
  </code></pre>
  
  <p>I'd like to extract the anonymous function as a named external one. Unfortunately I'm unable to figure out the right syntax to establish a code structure as shown above.</p>
  
  <p>Meanwhile, I figured out, that putting</p>
  
  <pre><code>function handleNode(item) {
      {console.log(item)}
  }
  </code></pre>
  
  <p>at the very end of the file works. Is it possible to make the handleNode method an object - "member" of the controller?</p>
  
  <p>Thanks in advance</p>
  
  <p>Chris</p>