1. #1
    Ext JS Premium Member
    Join Date
    Nov 2008
    Posts
    30
    Vote Rating
    0
    ljschrenk is on a distinguished road

      0  

    Default enableKeyEvents: true

    enableKeyEvents: true


    Greetings: I have the following text field in an ext form. enableKeyEvents = true however it does not ever make it in the keyup function. I am using Ext version 2.0.1, this was in that version wasn't it?
    Code:
    items: [{
                                xtype: 'textfield',
                                id: 'searchMe',
                                hideLabel: true,
                                autoWidth: true,
                                enableKeyEvents: true,
                                bodyStyle: 'padding 5px;',
                                listeners: {
                                    keypress: function(){
                                        console.warn('keypress');
                                    },
                                    keyup : function(){
                                        console.warn('key up');
                                        autoComplete(this.id, 'autocomplete');
                                    }
                                }
                            }]
    I'm sure it's something easy I am just out of ideas.

  2. #2
    Ext JS Premium Member
    Join Date
    Nov 2008
    Posts
    30
    Vote Rating
    0
    ljschrenk is on a distinguished road

      0  

    Exclamation


    Anyone?

  3. #3
    Sencha User fay's Avatar
    Join Date
    Apr 2007
    Location
    Ireland
    Posts
    1,750
    Vote Rating
    9
    fay will become famous soon enough fay will become famous soon enough

      0  

    Default


    ExtJS 2.2.1

    PHP Code:
    initComponent : function(){
      
    Ext.form.TextField.superclass.initComponent.call(this);
      
    this.addEvents(
        
    'autosize',
        
    'keydown',
        
    'keyup',
        
    'keypress'
      
    ); 
    ExtJS 2.0

    PHP Code:
    initComponent : function(){
      
    Ext.form.TextField.superclass.initComponent.call(this);
      
    this.addEvents(
        
    'autosize'
      
    ); 
    Easy enough to check in ext-all-debug.js for 2.0.1. I'd recommend moving up to 2.2.1.

  4. #4
    Ext JS Premium Member
    Join Date
    Nov 2008
    Posts
    30
    Vote Rating
    0
    ljschrenk is on a distinguished road

      0  

    Default


    I had to put the listener in the items section ABOVE my actual textfield:

    Code:
    items: [{
         columnWidth: .7,
         layout: 'form',
         enableKeyEvents: true,
         listeners: {
              'keyup' : function(){
                   autoComplete(this.id, 'autocomplete');
              }
         },
         items: [{
               // ENABLE KEY EVENTS AND LISTENER USED TO BE HERE BUT WOULD NOT WORK                            
              xtype: 'textfield',
              id: 'searchMe',
              hideLabel: true,
              autoWidth: true,
              bodyStyle: 'padding 5px;'							
    }]

  5. #5
    Sencha User
    Join Date
    Sep 2014
    Posts
    15
    Vote Rating
    -5
    MrFox can only hope to improve

      0  

    Default


    keyup works fine for me by adding it in the controller. But I want keydown or keypress events.

Thread Participants: 2