Results 1 to 5 of 5

Thread: How to capture label tap event on checkbox fields?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha Premium Member
    Join Date
    Jun 2011
    Location
    Nottingham, UK
    Posts
    24
    Vote Rating
    0
      0  

    Wink Answered: How to capture label tap event on checkbox fields?

    In sencha touch v1 you could do this:

    PHP Code:
        listeners
       {
          
    labelEl:{  
             
    tap:function () { 
                  var 
    obj Ext.getCmp('recall-0-1');                                                           
                  if (
    obj.isChecked()) {   obj.uncheck();  } 
                  else { 
    obj.check(); }
             }
          }
        } 
    This doesn't work in Touch 2 - so there must be a new way of capturing the label tap event.
    Any clues much appreciated?

    regards

    Tom

  2. you will have to do it after the component's element has been created and then do

    Code:
    cmp.label.on('tap', function() {}, cmp);

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    you will have to do it after the component's element has been created and then do

    Code:
    cmp.label.on('tap', function() {}, cmp);
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

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

  4. #3
    Sencha User rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,159
    Answers
    93
    Vote Rating
    7
      0  

    Default

    You *will* however be able to do this in the 2.0 final, as it is a regression.

    For now though, if you want to target the label element, you can use code similar to Mitchell's:

    Code:
    component.label.on('tap', function() {
        console.log('tap');
    });
    And as Mitchell said, it will need to be initialized first.
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

  5. #4
    Sencha Premium Member
    Join Date
    Jun 2011
    Location
    Nottingham, UK
    Posts
    24
    Vote Rating
    0
      0  

    Wink Thanks

    Cheers guys - works like a charm!

  6. #5
    Sencha User
    Join Date
    Feb 2014
    Posts
    2
    Vote Rating
    0
      0  

    Default

    Hi! In Sencha Touch?

Posting Permissions

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