title: How to distinguish list's itemtap from itemtaphold event in Sencha Touch 2
body: <p>I'm new to Sencha Touch 2.Today I encountered a problem,I want to add itemtap and itemtaphold events in a list's listeners,but I can't disable itemtap when itemtaphold fired.Usually,I would use a variable like dataView.config.istplhold to make this distinction in controller,but it doesn't work in listeners.Here is my code:</p>
  
  <pre><code>    itemTpl: ['&lt;table&gt;&lt;tr&gt;'+
            //'&lt;td&gt;{attachmentName}&lt;/td&gt;'+
           '&lt;td width="40px;"&gt;{i}&lt;/td&gt;'+
           // '&lt;td &gt;&lt;a  href="http://10.1.71.240:8080/tyoa/page/phone/request/leader/upload.jsp?attachmentId={attachid}&amp;attachmentName={attachmentName}"  id="uploadFile" style="text-decoration:none;"&gt;{attachmentName}({attachmentSize})&lt;/a&gt;&lt;/td&gt;&lt;/div&gt;'+
           '&lt;td style="word-wrap:break-word;word-break:break-all;"&gt;&lt;a style="text-decoration:none;"&gt;{attachmentName}({attachmentSize})&lt;/a&gt;&lt;/td&gt;'+
           '&lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/td&gt;'+
           '&lt;td style="white-space:nowrap;"&gt;&lt;span id="'+'{attachid}'+'test_002" style="color:#FFCC00;"&gt;&lt;/span&gt;&lt;/td&gt;'+ 
           '&lt;/tr&gt;&lt;/table&gt;',   
       ].join(''),
      listeners:{
            itemtap:function(dataView, index, target, record, e, eOpts){
               //alert("download");
               if (!dataView.config.istplhold){
                  var attachId=record.get('attachid');
                  var attachName=record.get('attachmentName');
                  // alert("attachId: "+attachId);
                  //alert("attachName: "+attachName);
                  $('#'+attachId+'test_002').text("Downloding...");
                  window.downloader.downloadFile(Global.proxyPortAndIP+"/tyoa/temp/"+attachId+"?"+attachName, {overwrite: true},
                      function(res){
                          $('#'+attachId+'test_002').text(res.progress+"%");
                          if(res.progress==100){
                              Ext.Msg.alert(attachName,"Downloading complete");
                              $('#'+attachId+'test_002').text("Download complete");
                          }
                      },function(error){
                          alert(error);
                          $('#'+attachId+'test_002').text("Download failed");
                      }
                  );
               }else{
                  dataView.config.istplhold = false;
               }
             },
  
             itemtaphold:function(dataView, index, target, record, e, eOpts){
                  var control = this;
                  // if (Global.istaphold){
                      this.actions = Ext.Viewport.add({
                          xtype : 'actionsheet',
                          items : [{
                              text : 'Delete',
                              scope : this,
                              handler : function() {
                                  Ext.Msg.confirm("Delete", "Are you sure to delete this item？", function(text) {
                                      if (text == 'yes') {
                                          // control.deleteContent(record.get('attachid'));
                                          var docbaseAttachmentId=record.get('attachid');
                                          Ext.data.JsonP.request({
                                              url : Global.API + '/docbase/docbaseListDelete.jsp',
                                              callbackKey : 'callback',
                                              params : {
                                                  id : docbaseAttachmentId,
                                                  format : 'json',
                                              },
                                              success : function(result) {
                                                  reg = result[0].reg;
                                                  if (reg == 'true') {
                                                      Ext.Msg.alert("", "Item deleted");
                                                  }
                                                  storeDocuments = Ext.getStore('docbaseAttachments');
                                                  recordIndex = storeDocuments.findExact('attachid',docbaseAttachmentId);
                                                  storeDocuments.removeAt(recordIndex);
                                                  storeDocuments.sync();
                                              },
                                          });
                                      }
                                  });
                                  this.actions.hide();
                              }
                          },{
                              text : 'Modify',
                              scope : this,
                              handler : function() {
                                  this.actions.hide();
                                  // control.updateDocbaseListDetail(record);
                                  view =Ext.create('tyoa.view.more.docbase.DocbaseListDetailPanel');
                                  view.setRecord(record);
                                  viewDirectionLeft(view);
                              }
                          },
                          {
                              xtype : 'button',
                              text : 'Cancel',
                              scope : this,
                              handler : function() {
                                  this.actions.hide();
                              }
                          }]
                      });
                      this.actions.show();
                  // }
                  dataView.config.istplhold = !dataView.config.istplhold;
             },
      },
  </code></pre>
  
  <p>Also,I see another solution in Sencha Forum:</p>
  
  <pre><code>    listeners : {
          itemtap : function(list) {
              if (!list.lastTapHold || (list.lastTapHold - new Date() &gt; 1000)) {
                  console.log('itemtap');
              }
          },
          itemtaphold : function(list) {
              list.lastTapHold = new Date();
              console.log('itemtaphold');
          }
      }
  </code></pre>
  
  <p>but it looks can only be used once,anyway,as the author said,it could lead to a memory leak.So can anyone give me any suggestion?Thank you in advance!</p>