1. #1
    Sencha User davisty's Avatar
    Join Date
    Mar 2010
    Location
    Spanish Fort, Al
    Posts
    228
    Vote Rating
    0
    Answers
    11
    davisty is on a distinguished road

      0  

    Default Answered: How to add longpress event to text field?

    Answered: How to add longpress event to text field?


    Hello,

    Im trying to add a longpress event to a text field, but it's not firing.

    What am I doing wrong.

    Code:
     items: [                                        
                        {                                       
                          xtype: 'textfield',                   
                          name : 'SCSCOD',                      
                          id   : 'SCSCOD',                      
                          value:  SCSCOD,                       
                          label: 'Shipper Code',                
                          useClearIcon: true,                   
       listeners: {                                             
                   longpress: function() {                            
                   alert('touched this');                       
                             }                                  
                        }                                       
                        },{

  2. Something like:

    Code:
    new Ext.form.FormPanel({
        fullscreen : true,
        items      : [
            {
                xtype     : 'textfield',
                label     : 'Test',
                listeners : {
                    element : 'el',
                    taphold : function() {
                        console.log('tap');
                    }
                }
            }
        ]
    });

  3. #2
    Sencha User davisty's Avatar
    Join Date
    Mar 2010
    Location
    Spanish Fort, Al
    Posts
    228
    Vote Rating
    0
    Answers
    11
    davisty is on a distinguished road

      0  

    Default


    Ps. I cant get any event to fire at all. Am I able to put a listener on a textfield?

    Thank You ...

  4. #3
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,661
    Vote Rating
    435
    Answers
    3109
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    longpress is on the element not the component itself.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  5. #4
    Sencha User davisty's Avatar
    Join Date
    Mar 2010
    Location
    Spanish Fort, Al
    Posts
    228
    Vote Rating
    0
    Answers
    11
    davisty is on a distinguished road

      0  

    Default


    Im not sure what that means. Can you give me an example, please.

  6. #5
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,661
    Vote Rating
    435
    Answers
    3109
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Something like:

    Code:
    new Ext.form.FormPanel({
        fullscreen : true,
        items      : [
            {
                xtype     : 'textfield',
                label     : 'Test',
                listeners : {
                    element : 'el',
                    taphold : function() {
                        console.log('tap');
                    }
                }
            }
        ]
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  7. #6
    Sencha User davisty's Avatar
    Join Date
    Mar 2010
    Location
    Spanish Fort, Al
    Posts
    228
    Vote Rating
    0
    Answers
    11
    davisty is on a distinguished road

      0  

    Default


    That worked but I dont understand the difference.

    I had used element: 'element', and it didnt work

    Thank You very much ...

  8. #7
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,661
    Vote Rating
    435
    Answers
    3109
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    element : 'element' is the ST 2 way of listening on the element, in ST 1, it's just 'el'. Think of it as a property on the component (not really as such but will work mostly)
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  9. #8
    Sencha User davisty's Avatar
    Join Date
    Mar 2010
    Location
    Spanish Fort, Al
    Posts
    228
    Vote Rating
    0
    Answers
    11
    davisty is on a distinguished road

      0  

    Default


    coolBeans ...

    You da man Mitch