• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Double event firing on double click on a grid

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Double event firing on double click on a grid

    I am using a "single" click event on a grid. If the user "double clicks" the grid instead of single click, then it is firing a 2nd event. I can see there are a lot of answers. Is there a preferred way to keep this from happening? I looked at solutions on Sencha's forums, but most of the answers go back to much earlier version of Extjs. Thanks for any help!

  • #2
    I assume your issue is that the click listener method is executing multiple times?

    Comment


    • #3
      Yes that is correct.

      Comment


      • #4
        Typically, you would mask the grid or the body when the user clicks a row....assuming that you are making some sort of network request or swapping to a new screen. If masked, the second click would not cause an event to fire.

        Alternately, you could "buffer" your itemclick listener:

        Code:
        listeners : {
            itemclick : {
                scope : me,
                buffer : 300,
                fn       : me.myMethod
            }
        }

        Comment


        • #5
          This application is built in Sencha Architect. Should this code be added into a new "controller action" or into this one?

          Code:
           onFileGrid_ItemClick: function(dataview, record, item, index, e, eOpts) {
                  Ext.ComponentQuery.query('#filegrid')[0].rec = record;
          
                  var ticket = record.get('DHDT#6'),
                      whse   = record.get('DHWHSE'),
                      status = record.get('DHLINE'),
                      doctyp = '#AFPDLVT';
                      pdfpanel = Ext.ComponentQuery.query('pdfpanel')[0];
                      me     = this;
          
                  if(status !== 'Released' && status !== 'Shipped'){
                      Ext.Msg.show({
                          title: 'Get BOL for Shipment',
                          msg: 'Images for this BOL Are Not Yet Available',
                          icon: Ext.Msg.INFO,
                          buttons: Ext.Msg.OK
                      });
          
                  }else{
          
                    //  var me = this;
                    //  Ext.getBody().mask();
                      Ext.Ajax.request({
                          scope        : me,
                          url            : '/valence/vvcall.pgm',
                          params        : {
                              pgm        : 'nocstrace',
                              action    : 'get_Images',
                              ticket  : ticket,
                              whse    : whse,
                              doctyp  : doctyp
                          },
                          success        : function(response){
                     //        Ext.getBody().unmask();
                              var r = Ext.decode(response.responseText);
                              if(r.success === true){
                                  var pdfWindow=Ext.create('NOCSTRACE.view.PDFwindow',{
                                      title: 'NOCS BOL IMAGE DISPLAY'
                                  }).show();
                                 var pdfpanel = Ext.ComponentQuery.query('pdfpanel')[0];
                                  console.log(r.pdfurl);
                                  pdfpanel.removeAll();
                                  pdfpanel.add({
                                      xtype: 'component',
                                      autoEl: {
                                          tag: 'iframe',
                                          src: r.pdfurl,
                                          style: 'border:none;height:100%;width:100%'
                                      }
                                  });
                              }else{
                                  Ext.Msg.show({
                                      title: 'Get BOL for Shipment',
                                      msg: 'No Image Found',
                                      icon: Ext.Msg.INFO,
                                      buttons: Ext.Msg.OK
                                  });
                              }
                          },
                          failure: function(){
                           //   Ext.getBody().unmask();
                              alert('an error occured');
                          }
                      });
                  }
              }

          Comment


          • #6
            I would simply add back the mask and unmask method calls that you have commented out.

            Comment


            • #7
              That worked. 'Thanks for your help!

              Comment

              Working...
              X