title: EXTJS 4: Adding listeners to elements not consistent
body: <p>I'm working with an EXTJS 4 dataview and having inconsistent results when adding listeners to html elements (links) in each data node.  I have placed the code in the load listener on the store that is tied to the dataview.  It appears to work on the first load but subsequent loads get worse as it begins missing some elements.  Each time a call store.reload() it gets worse.</p>
  
  <p>I have verified in firebug that the html element ID's are rendering properly but for some reason when I reload the store it begins to miss some elements at first, then all elements.  Code for the load listener below:</p>
  
  <pre><code>listeners: {
              load: function(store, records, successful, options){
                      var nodes = records;
                      for (i=0, len = nodes.length; i &lt; len;i++){
                          var id = nodes[i].data.id;
                          var addtocartel = Ext.get('img-cart-'+id);
                          var viewel = Ext.get('img-view-'+id);
                          //Setting hidden class for nonimage items
                          switch (nodes[i].data.type) {
  
                              case 'image' :
                              viewel.addCls('imgprf');
                              addtocartel.addCls('cartprf');
                              break;
  
                              default :
                              viewel.addCls('sc_hidden');
                              addtocartel.addCls('sc_hidden');
                              viewel.hide();
                              addtocartel.hide();
                              break;
                          }
  
                          if(addtocartel !== null){
                              addtocartel.itemid = id;
                              addtocartel.on('click', function(e,t){
                                var el = Ext.get(t);
                                var imgrec = imagestore.getById(el.itemid);
                                e.stopEvent(); 
                                prfproductwindow.show();
                              });
                          }
                          if(viewel !== null){
                              viewel.itemid = id;
                              viewel.on('click', function(e,t){
                                  var el = Ext.get(t);
                                  var imgrec = imagestore.getById(el.itemid);
                              });
                          }
                      }
              }
          }
  </code></pre>