Results 1 to 6 of 6

Thread: Question on double click and single click event handlers within grid

  1. #1
    Sencha User
    Join Date
    Jan 2008
    Posts
    154

    Default Question on double click and single click event handlers within grid

    I seem to be having a problem in a GridPanel where the event handler function for the rowclick within a grid is being called for both the rowclick and the rowdblclick. I have tried other suggestions on this forum but have not been able to fix the problem. Any help would be appreciated.

    Code:
    function handleRowClick(grid, rowIndex, myElement){
      
         var p = new Ext.Panel({
             title: 'Project',
              html: Ext.example.bogusMarkup
         });
       var window2 = new Ext.Window({
      	title: 'Detail', 
    	modal: true, 
                 items: p
       });
        
       window2.show();
    
    };
    
    function handleDoubleRowClick(grid, rowIndex, myElement){
      
        
        var tab2 = new Ext.TabPanel({
              renderTo: document.body,
              activeTab: 1,
              width:600,
              height:400,
              plain:true,
        
               items:[{
                    title: 'Properties'
                    //html: "My content was added during construction."
     	        },{
                    title: 'Tab1',
     		
                    listeners: {activate: handleActivate}
                   },{
                    title: 'Tab2'
                                 
                  },{
    	    title: 'Tab3'
    	 },{
    	    title: 'Tab4'
    	 },{
    	    title: 'Tab5'
              
                }
            ]
        });
    
       var viewport = new Ext.Window({
           pageX:10,
            pageY:430,
            title: 'Detail', 
            closeAction:'hide',
            width:600,
            items: tab2
       });
        
       viewport.show();
    
    };
    
    // Code to handle the events for the grid
    Ext.extend(SampleGrid2, Ext.grid.GridPanel,
    {
          listeners: ({
                        'rowdblclick':handleDoubleRowClick,
                          'rowclick': handleRowClick	
    	        })
    }

  2. #2
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    I realize that I may sound like a jerk, but isn't that by design? Doesn't a double click start with a single click?

  3. #3
    Ext User para's Avatar
    Join Date
    Apr 2007
    Location
    Redmond, WA
    Posts
    918

    Default

    Not a jerk at all. Having a single AND double click action rarely works, unless the single-click is some sort of selection or quasi-action.

  4. #4
    Sencha User
    Join Date
    Jan 2008
    Posts
    154

    Default

    But in reading the following forum post, it appears that these both should work:

    http://extjs.com/forum/showthread.ph...ht=rowdblclick

  5. #5
    Ext User para's Avatar
    Join Date
    Apr 2007
    Location
    Redmond, WA
    Posts
    918

    Default

    Let me rephrase: Having a 'click' event and a 'dblclick' event usually breaks the user's conceptual model. They have an "innate" sense of what an application should do just by looking at it and playing with it. The only way I've seen to implement both that doesn't break the model is if the single click is some sort of selection action, while the dblclick is an action, like edit or visit.
    Having both events WILL (should) work in the code.

  6. #6
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996

    Default

    Or maybe use a contextmenu / right click for additional options aside from the 'intuitive' left click options?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •