Results 1 to 6 of 6

Thread: check method & event

  1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    37
    Vote Rating
    1
      0  

    Default Answered: check method & event

    check/uncheck method triggers appropriate events in ST1.1, but it is not like that in ST2.0. How to have that in ST2.0 code?

  2. It's not needed. To change the check status, it simple toggles the dom.checked field:

    Code:
        onMaskTap: function(component, e) {
            var me = this,
                dom = component.input.dom;
    
            if (me.getDisabled()) {
                return false;
            }
    
            //we must manually update the input dom with the new checked value
            dom.checked = !dom.checked;
    
            //continue as normal, like a normal tap
            // this.onTap(component, e);
    
            //calling getchecked will sync the new checked value
            if (me.getChecked()) {
                me.fireEvent('check', me, e);
            }
            else {
                me.fireEvent('uncheck', me, e);
            }
    
            //return false so the mask does not disappear
            return false;
        },

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

    Default

    What do you mean? When you check a checkbox or radio field, the check event is fired. When you uncheck it, the uncheck event is fired.
    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
    Join Date
    Jul 2011
    Posts
    37
    Vote Rating
    1
      0  

    Default

    exactly

  5. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Answers
    3931
    Vote Rating
    1271
      0  

    Default

    Ok, that's how Sencha Touch 2 works.
    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

  6. #5
    Sencha User
    Join Date
    Jul 2011
    Posts
    37
    Vote Rating
    1
      0  

    Default

    sorry, mean not that but calling check()/uncheck() methods

  7. #6
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Answers
    3931
    Vote Rating
    1271
      0  

    Default

    It's not needed. To change the check status, it simple toggles the dom.checked field:

    Code:
        onMaskTap: function(component, e) {
            var me = this,
                dom = component.input.dom;
    
            if (me.getDisabled()) {
                return false;
            }
    
            //we must manually update the input dom with the new checked value
            dom.checked = !dom.checked;
    
            //continue as normal, like a normal tap
            // this.onTap(component, e);
    
            //calling getchecked will sync the new checked value
            if (me.getChecked()) {
                me.fireEvent('check', me, e);
            }
            else {
                me.fireEvent('uncheck', me, e);
            }
    
            //return false so the mask does not disappear
            return false;
        },
    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

Posting Permissions

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