Omar Faruq
Omar Faruq

Reputation: 1220

extjs4.1 textfield dblclick event not work in mvc

I work with mvc. When i double click on a textfield it not listening. But specialkey that means enter work perfectly. where is my fault. Here is my text field

{
            xtype             : 'textfield',
            name              : 'articleName',
            fieldLabel        : 'Article',                
            allowBlank        :  false,
            readOnly          :  true,
            width             :  253,
            enableKeyEvents   :  true
        }

and here is my controller

sv01t01000102 textfield[name=articleName]':{
             specialkey: function (field, el) {
                if (el.getKey() == Ext.EventObject.ENTER || el.getKey()==el.TAB){
                    console.log('World')
                }
            },
            dblclick : function(field, el){
                  console.log('Hello')
            }
        }

Can you help me?

Upvotes: 1

Views: 878

Answers (3)

Robert R.
Robert R.

Reputation: 61

Just in case somebody stumbles over this and want's to solve it in the MVVM way.

View

{
  xtype: 'textfield',
  listeners: {
    afterrender: view => {
      view.getTargetEl().on('dblclick', 'onDblclick');
    }
  }
}

Controller

onDblclick() {
  console.log(arguments) // Pick what you need
}

Upvotes: 0

KBIIX
KBIIX

Reputation: 911

'textfield[name = articleName]':{
    render: function (component) {
        component.getEl().on('dblclick', function(event, el) {
            alert('You dblclicked on textfield!');
        })
    }
}

Upvotes: 0

Evan Trimboli
Evan Trimboli

Reputation: 30082

Field doesn't have a double click event. Typically you'll do something like:

textfield[name=articleName]': {
    afterrender: function(c) {
        c.inputEl.on('dblclick', function() {
            console.log('double');
        });
    }
}

Upvotes: 3

Related Questions