1. #1
    Touch Premium Member
    Join Date
    Sep 2010
    Posts
    8
    Vote Rating
    0
    hdpdev02 is on a distinguished road

      0  

    Default How does it work? Itemclick and itemdblclick

    How does it work? Itemclick and itemdblclick


    Hello,

    i´m testing ext 4.0.1. Now I have a problem with a grid in an border-layout.

    When i make a double-click on a row the itemclick event is fired twice before the dblclick event.
    How can I achieve that both events work properly? And how can I call the method test / test2 to perform some actions?


    Thanks in advance

    HTML Code:
    Ext.define('TestGrid', {
      extend: 'Ext.grid.Panel',
      
      alias: 'widget.testgrid',
      
      itemId: 'mandant',  
      initComponent: function(){
      
        
        contextMenu = Ext.create('Ext.menu.Menu', {
          items: [
            {                        
              text: 'regular item 1',
              id: 'one',
              iconCls: 'add'                   
            },
            {
              text: 'regular item 2',
              id: 'two'                    
            },
            {
              text: 'regular item 3',
              id: 'three'                    
            }
          ]
        });
    
        Ext.apply(this, {
          fieldLabel: 'Blubb',
          delay: 100,
          columnLines: true,
          store: store,
          selType: 'rowmodel',
          columns: [
            {
              text     : 'Name',
              sortable : true,
              dataIndex: 'company',
              flex: 1
            },
            {
              text     : 'Name',
              sortable : false,
              hidden: true,
              dataIndex: 'price',
              width: 100
            }
          ],
                        
          viewConfig: {
            stripeRows: true,
            listeners: {
              itemcontextmenu: function(view, rec, node, index, e) {
                e.stopEvent();
                contextMenu.showAt(e.getXY());
                return false;
              },
              itemdblclick: function(view, rec, node, index, e) {
                console.info('dblclick');
                this.panel.test2();
              },
              itemclick: function(view, rec, node, index, e) {
                console.info('click');
                this.panel.test();
              }
            }
          }
        });
        TestGrid.superclass.initComponent.apply(this, arguments);
      },
      
      rowcontextmenu: function(grid, rowIndex, e){
        this.contextMenu.showAt(e.getXY());
      },
    
      test: function(){
        alert('click');
      },
    
       test2: function(){
        alert('dbl');
      }
    });

  2. #2
    Sencha Premium Member ajaxvador's Avatar
    Join Date
    Nov 2007
    Location
    PARIS, FRANCE
    Posts
    206
    Vote Rating
    0
    ajaxvador is on a distinguished road

      0  

    Default


    i have a same problem.

    when i found a solution, i share it with u
    Last edited by ajaxvador; 20 May 2011 at 5:38 AM. Reason: no
    Vador

  3. #3
    Touch Premium Member
    Join Date
    Sep 2010
    Posts
    8
    Vote Rating
    0
    hdpdev02 is on a distinguished road

      0  

    Default


    Does no one have an idea how to split these two events?

  4. #4
    Ext JS Premium Member makiss's Avatar
    Join Date
    Jun 2008
    Location
    NYC
    Posts
    27
    Vote Rating
    0
    makiss is on a distinguished road

      0  

    Default


    working on same issue. no luck so far. If someone has found this please post I will do the same

    cheers

  5. #5
    Sencha User
    Join Date
    Apr 2012
    Posts
    1
    Vote Rating
    0
    DevikaLad is on a distinguished road

      0  

    Default itemclick and itemdblclick together issue

    itemclick and itemdblclick together issue


    Hi All,
    I too am hunting and waiting for some miracle to be created by sencha to make itemclick and itemdblclick work simulataneously.
    My observations are -
    If we have an alert statement in the procedures being called on itemclick and itemdblclick, both the events work as expected to.
    But on removal of the alert statement it behaves badly, itemclick works but itemdblclick gives errnous results.

    Can some one help all of us.
    Regards

  6. #6
    Sencha User alumb's Avatar
    Join Date
    Apr 2009
    Location
    Vancouver, BC, Canada
    Posts
    9
    Vote Rating
    0
    alumb is on a distinguished road

      0  

    Default Solution

    Solution


    Finally found a solution:
    Code:
    treepanel.on("itemclick", function(view, record, item, index) {
        //function
    },this,{delay:300,buffer:true});
    
    treepanel.on("itemdblclick", function(view, record, item, index) {
        //function
    });
    This seems to solve the problem and allow the dblclick function to be called.

  7. #7
    Sencha Premium Member
    Join Date
    Apr 2010
    Location
    Wellington, New Zealand
    Posts
    123
    Vote Rating
    5
    zerkms is on a distinguished road

      0  

    Default


    Quote Originally Posted by alumb View Post
    Finally found a solution
    Don't you get your itemclick handler called after 300ms anyway? Delay only delays the execution.

  8. #8
    Sencha User alumb's Avatar
    Join Date
    Apr 2009
    Location
    Vancouver, BC, Canada
    Posts
    9
    Vote Rating
    0
    alumb is on a distinguished road

      0  

    Default


    Quote Originally Posted by zerkms View Post
    Don't you get your itemclick handler called after 300ms anyway? Delay only delays the execution.
    The problem I had was that if the itemclick event was defined, then the itemdblclick event was never fired.

    If you needed them to fire mutually exclusively, you could add some code to stop the itemclick event from firing if the itemdblclick event was fired in the last 300ms.

  9. #9
    Sencha Premium Member i.stojanovic's Avatar
    Join Date
    Oct 2010
    Location
    Kragujevac, Serbia
    Posts
    24
    Vote Rating
    0
    i.stojanovic is on a distinguished road

      0  

    Default Wrong approach.

    Wrong approach.


    You don't need to use itemclick and itemdblclick events.
    Use select and itemdblclick events
    www.codelighter.com
    There are 10 types of people in this world, those who understand binary and those who dont